Today I've been playing around to find a mechanism to update the My Network Places folder in a network environment to contain links to all SharePoint Document Libraries on a given server. I still have to put pieces together and fill in missing links, but here are some frustrating things I've been sailing around :o. Notice that all of the following only works on a machine with Office 2003 (maybe earlier releases too) to introduce the notion of "web folders" in the shell.
1. My Network Places contains links to - guess what - network locations. These are stored in %HOMEPATH%\Nethood under a user's profile in the form of folders (which have the name of the link that appears in the list in Windows Explorer) containing two files: target.lnk and desktop.ini
2. target.lnk is the hardest one to get right. Up till now, I've not found a way to create such a link programmatically (doing a lot of P/Invoke and interop stuff in C#). The pieces of the puzzle are called IShellLink, it's method SetIDList, PIDL and SHGetFolderLocation and CSIDL_NETHOOD. If someone finds a way to create a .lnk file to a web folder using these pieces of the puzzle, let me know (C# managed code preferred, but WSH/VBScript or C++ solutions are also welcome). In most cases, the file was renamed to a .url file which is handled by IE.
3. desktop.ini contains the following:
4. Retrieving all document libraries in all subwebs of a given SharePoint site was a piece of cake using the SharePoint .asmx files. You can find the code of my "crawler" over here in a zip file: sharepointwebcrawler.zip. It retrieves the title and url of every document library it can find recursively. Please notice this code can be improved further, especially the tricky part to extract the document library's base URL.
5. Once you have the list of all document libraries (URL + title) you need to create the target.lnk files and the folders. Right now, this is the missing link in my solution (see point 2 above) and requires manual interaction.
6. Deploy the created .lnk files to all target machines. If you thought it was as easy as doing xcopy of the entire Nethood folder, you're wrong. Okay, it's basically that but first you should not forget to copy the hidden desktop.ini file too, and second, all folders need to be marked as read-only (otherwise these don't appear as "shortcuts" but as normal folders containing a target.lnk file). I did end up with something like this:
xcopy /E /H %SOURCEDIR% .
attrib +R /D /S .*
What a nightmare :s. Dreaming of .lnk files to become XML-files :-).Del.icio.us
| Digg It