Adding folders to libraries - Windows 7

Grayda

Member
Joined
May 20, 2010
Messages
16
Programming Experience
10+
At my workplace, we're having troubles with Windows 7. Folders that are supposed to be in the libraries (e.g. Documents Library) aren't appearing. While we sort the issue out via Group Policy, I'd like a "DIY fix" that people can run and keep working instead of flooding IT support with requests. From snooping around, I've found that the folders are stored in an XML file here:

%userprofile%\AppData\Microsoft\Windows\Libraries\Documents.library-ms

The file looks like this:

VB.NET:
<?xml version="1.0" encoding="UTF-8"?>
<libraryDescription xmlns="http://schemas.microsoft.com/windows/2009/library">
  <name>@shell32.dll,-34575</name>
  <ownerSID>S-1-5-11-1111111111-1111111111-1111111111-1111</ownerSID>
  <version>21</version>
  <isLibraryPinned>true</isLibraryPinned>
  <iconReference>imageres.dll,-1002</iconReference>
  <templateInfo>
    <folderType>{7d49d726-3c21-4f05-99aa-fdc2c9474656}</folderType>
  </templateInfo>
  <propertyStore>
    <property name="HasModifiedLocations" type="boolean"><![CDATA[true]]></property>
  </propertyStore>
  <searchConnectorDescriptionList>
    <searchConnectorDescription>
      <isDefaultSaveLocation>true</isDefaultSaveLocation>
      <isSupported>true</isSupported>
      <simpleLocation>
        <url>C:\Users\myuser\Documents</url>
        <serialized>MBAAAEAFCAAAAAAAADAAAAAAAY0gAAQBAAAAAIAyMd3vBmcAX99IaXl8LHwVfPi2VJ/yBAAABAAAAAAABAAAAAAAAAAAAAAAAAAAA8LAUAwHQB

+TQDi66kGEiiNCAsCMw0ZGA8yQ6wFAAAAAAAAAAAAAAAAAAAAAAAAAQBQMAAAAAAQc8gtrQAwUoFmclNHAAoDAIAABA8uvxxDpuGHPY7qKAAAAvKNAAAAAEAAAAAAAAAAAAAAAAAAAAMFAoBQYAIHAlBwcAAAAWAAQAEDAAAAAAEHPY7K

EEgGAwAACAQAAv7bc8gtrxxD2uqCAAAQhbDAAAAgCAAAAAAADAAAoAAAAAAAAoBAAAABAAAgOAAAAcAAAAEAAAAAHAAAAtAAAAAAAAAQOAAAARAAAAMAAAAQ4O

+rnQAAAAAwQ6w1UoFmclNHXoBAAoAAAAkAAAAKHAAAAxMFUTJuiYZEvMhzQ7y/ETaCmt5MAAAAAAAAAAAGAAAwAAAAoYBAAAAAAAAwcwNGasBXL4BHMxAAAAAAAAAAAAAAAAAAAAAAAAAAAAI3ilzUDu3dE0qMAh4lUW6NAAAAAAAAAAA

AAAAAAAAAAytY5M1g7dHBtKDQIeJlleDAAAAA</serialized>
      </simpleLocation>
    </searchConnectorDescription>
  </searchConnectorDescriptionList>
</libraryDescription>

I can edit it by hand or programatically, but there is a node called <serialized> which is a long string of alphanumeric characters. It's not necessary (I can manually add folders without this and it works fine) but I was thinking there must be a better way to go about this, so my question is:

Is there a VB.NET function or class that lets me add and query folders in the library without manually creating the XML and inserting it myself? I'm happy to do it myself, but if there is a better way to go about it, I'm all for it!
 

Estuardo

Well-known member
Joined
Nov 27, 2004
Messages
45
Location
Portugal
Programming Experience
5-10
G'd morning Grayda,
Have you tried
Windows® API Code Pack for Microsoft® .NET Framework
i think it will meet your needs.
Windows® API Code Pack for Microsoft® .NET Framework provides a source code library that can be used to access some features of Windows 7 and Windows Vista from managed code. These Windows features are not available to developers today in the .NET Framework.
G'd luck
 
Top Bottom