Like all Office programs, Outlook has a rich object model for external automation, but there's a potential hitch: Such a script will work only if the user is running Outlook with the desired mail profile. Do you set up Outlook using the ORK tools so that all users have a mail profile of the same name as their default profile? If so, then you should be able to use something like this in a .vbs script:
On Error Resume Next
Set objOL = GetObject(, "Outlook.Application")
If objOL Is Nothing Then
Set objOL = CreateObject("Outlook.Application")
Set objNS = objOL.GetNamespace("MAPI")
objNS.Logon "Profile Name", "", "", True
blnWeStartedOL = True
End If
Set objFolder = GetFolder(objNS, "Public Folders\All Public Folders\Parent Folder\Contacts Folder")
If Not objFolder Is Nothing Then
objFolder.ShowAsOutlookAB = True
End If
Set objFolder = Nothing
If blnWeStartedOL Then
objNS.Logoff
objOL.Quit
End If
set objNS = Nothing
Set objOL = Nothing
Function GetFolder(objNS, FolderPath)
' folder path needs to be something like
' "Public Folders\All Public Folders\Company\Sales"
Dim aFolders
Dim fldr
Dim i
Dim objNS
On Error Resume Next
strFolderPath = Replace(FolderPath, "/", "\")
aFolders = Split(FolderPath, "\")
'set the root folder
Set fldr = objNS.Folders(aFolders(0))
'loop through the array to get the subfolder
'loop is skipped when there is only one element in the array
For i = 1 To UBound(aFolders)
Set fldr = fldr.Folders(aFolders(i))
'check for errors
If Err <> 0 Then Exit Function
Next
Set GetFolder = fldr
End Function
If you don't know the profile name, then use this Logon statement instead:
objNS.Logon "", "", True, True
--
Sue Mosher, Outlook MVP
Author of Configuring Microsoft Outlook 2003
and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers