Wednesday, October 31, 2007

Making Document Libraries More Accessible: Scripting Network Places and Network Locations

That is a very interesting and useful article i found. Enjoy it

Focused on the integration between Microsoft Office applications and SharePoint, I discussed options for making it easier for users to get to their document libraries. Expecting them to type a long URL in the File Open or File Save dialog boxes isn't realistic. I mentioned that by putting network places (Windows XP) and network locations (Windows Vista) in strategic locations, you can give users a much easier way to navigate to their libraries.

To make a long story short, network places and network locations are the same thing (Vista just had to rename them). They're the beautiful love child of a shortcut and a mapped drive. They're born in the My Network Places folder (XP) or in the Computer folder (Vista), but they can be moved anywhere, like a shortcut. Also like a shortcut, they can have descriptive, friendly names. Like a mapped drive, they appear as a folder in the Windows Explorer folder tree, allowing users to expand their contents.
Network places/locations are, in my opinion, one of the most useful UI elements in existence--and one of the most underutilized. Create network places/locations not just to SharePoint document libraries, but also to regular shared folders needed by users. I suggest putting network places/locations to commonly used targets on the desktop, and then putting other network places/locations in the My Network Places or Computer folder. But you can put them anywhere--even in users' (My) Documents folder or in the root of their user profile (which is great for Vista).
Here's what I recommend:
1. Determine which network folders (SharePoint document libraries and shared folders) are accessed by a user.
2. Create network places/locations that target those folders.

  • Create network places on XP in the My Network Places folder.
  • Create network locations in Vista by opening Computer, right-clicking in an empty area, and choosing Add A Network Location.
  • For SharePoint document libraries, the "target" should be the UNC to the document library, in the form \\ server \ site \[ subsite \]library, or the URL, in the form http:// server / site /[ subsite /] library . Experiment to determine what works best for your clients--there are differences between Vista and XP in how they respond to library addresses. The actual location where the network places/locations are created is the Nethood folder: %userprofile%\Nethood in XP, or in Vista %userprofile%\AppData\Roaming\Microsoft\Windows\Network Shortcuts.
  • Network places/locations in the Nethood folder are shown in the My Network Places folder in XP. In Vista, the network locations appear in two places: in the Network Locations group in the Computer folder and in the Network Shortcuts folder.
3. Organize the network places/locations to make them easily accessible.
  • You might choose to put the most commonly used network places/locations on the desktop, in the [My] Documents folder or (on Vista) in the root of the user's profile, which can be accessed by clicking the user name in the Start menu.
  • Less commonly used network places can be left in the Nethood folder.
  • When a user chooses the Open or Save command, Office 2003 & Office 2007 start a user in the last folder they were accessing, or in the (My) Documents folder. A user can click My Network Places if they're running XP or Desktop (or Computer) if they're running Vista and, from there, it's one more click to the document library if you've placed their network places/locations there. Interestingly, Network Shortcuts is not in the "links" by default on a Vista client. You can resolve this by adding a shortcut to the Nethood folder into the user's Links folder.
  • When an Office 2007 user chooses the Publish to Document Management Server command, the dialog box that appears is focused on the My Network Places (XP) or Network Shortcuts folder (Vista). The "Desktop" folder is one click away in the dialog box. That would suggest that the Nethood folder or the Desktop would be good places for network places/locations.

4. Disable XP's default behavior to automatically create network places. XP had an annoying habit of adding network places automatically, which fills up the Network Places folder with junk, and (I think) was one of the reasons why a lot of enterprises never took advantage of this great feature. To disable the automatic creation of network places, use Group Policy settings: User Configuration \ Administrative Templates \ Desktop \ Do not add shares of recently opened documents to My Network Places.
Finally, a number of users asked if it's possible to script the creation of network places/locations to speed deployment and management of network places. The answer is, "Yes!" The script follows at the end of this newsletter.
Until next time, happy SharePointing!
Dan Holme
dan h [at] (intelliem dot toplevel commercial domain)

' Create a network place (XP) or network location (Vista)

Option Explicit

' Generic objects - can be moved to global part of script

Dim WSHShell, FSO

Set WSHShell = WScript.CreateObject("WScript.Shell")

Set FSO = CreateObject("Scripting.FileSystemObject")

Dim sFolderPath, sTargetPath


' Example A: a document library network place/location created in the Nethood folder

sFolderPath = WSHShell.SpecialFolders("NetHood") & "\" & "Expense Reports Document Library"

sTargetPath = "\\\finance\expensereports"

CreateNetworkPlace sFolderPath, sTargetPath

sFolderPath = WSHShell.SpecialFolders("Desktop") & "\" & "Departmental Shared Folder"

sTargetPath = "\\server01\data$\departments\finance"

CreateNetworkPlace sFolderPath, sTargetPath

' This routine will create a network place

' which is actually a read only folder

' containing a regular shortcut named target.lnk and

' a desktop.ini file with specific contents

Sub CreateNetworkPlace(sFolderPath, sTargetPath)

Dim oTextFile, oFolder, oShortcut

' Create the folder and make it read only (required for Network Place)

If FSO.FolderExists(sFolderPath) Then

FSO.DeleteFolder sFolderPath, True

End If

' Create the folder

Set oFolder = FSO.CreateFolder(sFolderPath)

' Read-only attribute

oFolder.Attributes = 1

' Create the shortcut to the target inside the folder

Set oShortcut = WSHShell.CreateShortcut(oFolder.Path & "\target.lnk")

oShortcut.TargetPath = sTargetPath


' Create the Desktop.ini file which makes it a Network Place and assigns the icon

Set oTextFile = oFolder.CreateTextFile("Desktop.ini", True)

oTextFile.WriteLine "[.ShellClassInfo]"

oTextFile.WriteLine "CLSID2={0AFACED1-E828-11D1-9187-B532F1E9575D}"

oTextFile.WriteLine "Flags=2"

oTextFile.WriteLine "ConfirmFileOp=0"

' 1 displays a warning that this is a system folder when moving, deleting, renaming a system folder

' 0 avoids the warnings


End Sub



Anonymous Anonymous said...

Great. The function 'Open with Windows Explorer' from MOSS is buggy and not fully WebDAV enabled. We're planning to replace it with such a script.

8:53 AM


Post a Comment

<< Home