forums Home Forums Start Page Forums Frequently Asked Questions FAQ Member List Members List
Go Back   Petri IT Knowledgebase Forums > Messaging Software > Exchange 2007 / 2010 / 2013 is happy to award RicklesP the title of Most Valuable Member !!!
Register Calendar Calendar Search Petri IT Knowledgebase Forums Search Todays Posts Today's Posts Mark Forums Read

Script to select "Show this folder as an email address book"

Script to select "Show this folder as an email address book"

this thread has 0 replies and has been viewed 1047 times

Closed Thread
Thread Tools Search this Thread Display Modes
Old 13th April 2012, 01:55
newone88 newone88 is offline
 Join Date: Nov 2010
  6 month star 12 month star
 Posts: 7
 Reputation: newone88 is on a distinguished road (10)
Default Script to select "Show this folder as an email address book"

I'm trying to get this cript to work to with Exchange 2010 server but it is not working for some reason. We have 20 distribution lists in our public folders. We have to right click on each and enabale "Show this folder as an email address book" for each user.
Looks like this script might do the job but it is not running correctly.
It fails on GetObject line
Can someone help?

Dim aFolders, fldr, i, j, objNS, FolderPath
rootFolder = "Public Folders\All Public Folders\EMAIL DISTRIBUTION LISTS"
Set objNS = GetObject("", "Outlook.Application").GetNamespace("MAPI")
aFolders = Split(rootFolder, "\")
On Error Resume Next
Set fldr = objNS.Folders(aFolders(0))
If Err Then WScript.Quit
For i = 1 To UBound(aFolders)
Set fldr = fldr.Folders(aFolders(i))
If Err Then WScript.Quit
On Error Goto 0
'here 'fldr' contains your starting 'rootFolder' object, now enum all subfolders in there:
EnumSubFolders fldr 'call recursive function for this folder
Set objNS = Nothing
Function EnumSubFolders(tempfolder)
'folder types: 0 = mail; 1 = calendar; 2 = contacts; 3 = tasks; 4 = journal; 5 = notes
If(tempFolder.DefaultItemType = 2) Then
tempFolder.ShowAsOutlookAB = True 'mark current folder as mail address book
End If
If tempfolder.Folders.Count Then 'if there are several subfolders in here
For j = 1 To tempfolder.Folders.Count
EnumSubFolders tempfolder.Folders(j) 'call same function again for each subfolder
End If
End Function
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Find average bandwidth using "show interface" command? ingram Cisco Routers & Switches How-to 2 17th June 2011 22:39
Is it possible to have some kind of "comment" or "description" for a folder? alleycat7th Windows Vista 2 10th February 2009 13:00
"Select a profile" popup doesn't displayed when outlook start quentinc Exchange 2007 / 2010 / 2013 3 25th September 2007 18:28
2 NICs how to select "primary" gregaSLO Windows Server 2000 / 2003 / 2003 R2 8 6th June 2007 00:01
"Junk E-mail" folder under "Tasks" sorinso Outlook 0 15th December 2006 11:00

All times are GMT +3. The time now is 13:57.

Steel Blue 3.5.4 vBulletin Style ©2006 vBEnhanced
Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2015, Jelsoft Enterprises Ltd.

Valid XHTML 1.0!   Valid CSS!

Copyright 2005 Daniel Petri