Here ya go. This also fixes a couple of bugs in the microsoft example. '////////////////////////////////////////////////////////////////////// ' Function: ' createPublicFolder ' ' Purpose: ' Creates a mapi public folder with the specified name (from the ' root of the mapi folder tree). ' ' Input: ' strFolderName Name of public folder ' ' Output: ' createPublicFolder Contains Error code (if any) ' ' Based on: ' http://msdn.microsoft.com/library/en-us/wss/wss/_hosting_createpublicfol der.asp '////////////////////////////////////////////////////////////////////// Function createPublicFolder (ByVal strFolderName) Dim objFolder Dim strConnString Dim strDefaultDomain Dim strStorageName On Error Resume Next Err.Clear Call GetDefaultSMTPDomain (strDefaultDomain) ' Get the WSS name. strStorageName = "file://./backofficestorage/" & strDefaultDomain & "/" ' Build the folder name. strConnString = strStorageName & "public folders/" & strFolderName ' Create the folder. Set objFolder = CreateObject ("cdo.folder") If Err.Number Then createPublicFolder = Err.Number e "Couldn't createobject for " & strConnString Exit Function End If ' Set the folder properties. With objFolder .Description = "Root folder for " & strFolderName .ContentClass = "urn:content-classes:folder" .Fields ("http://schemas.microsoft.com/exchange/outlook/outlookfolderclass";) = "IPF.Folder" .Fields.Update .DataSource.SaveTo strConnString End With If Err.Number Then createPublicFolder = Err.Number e "Couldn't SaveTo/Create " & strConnString Exit Function End If createPublicFolder = 0 ' Clean up. Set objFolder = Nothing e "Created " & strConnString End Function '////////////////////////////////////////////////////////////////////// ' Function: ' GetDefaultSMTPDomain ' ' Purpose: ' Obtains the default SMTP domain for the organization, which defines ' the WSS/BackOfficeStorage filename. ' ' Output: ' strDefault Contains the default SMTP domain ' ' Based on: ' My own code '////////////////////////////////////////////////////////////////////// Sub GetDefaultSMTPDomain (ByRef strDefault) Dim strAddress ' string Dim strAddresses ' collection of addresses Dim objPolicy ' reference to Default Recipient Policy strDefault = "" Set objPolicy = GetObject ("LDAP://CN=Default Policy,CN=Recipient Policies," + strOrgDN) strAddresses = objPolicy.Get ("gatewayProxy") ' strAddresses contains all the addresses specified on the ' E-Mail Addresses tab of the default recipient policy For Each strAddress in strAddresses If Left (strAddress, 5) = "SMTP:" Then strDefault = Right (strAddress, Len (strAddress) - 6) ' strip SMTP:@ End If dp "Email address suffix: " & strAddress Next ' Report our results e "Default SMTP address for organization: " & strDefault Set strAddresses = Nothing Set objPolicy = Nothing End Sub ________________________________ From: Tim Sutton [mailto:T.Sutton@xxxxxxxxxx] Sent: Friday, May 13, 2005 10:09 AM To: [ExchangeList] Subject: [exchangelist] Scripting Public Folders http://www.MSExchange.org/ Hi all! Is it possible / does anyone know of a script that can be used to create public folders? Basically we're using public folders to store incoming and outgoing job related e-mails and sometimes the list comes through for a lot of folders to be created in one go. I'd ideally like to script this to save a lot of time and effort, but I don't even know if it's possible! Thanks for any help :) For Troup Bywaters + Anders Tim Sutton T: +44 (0) 113 243 2241 F: +44 (0) 113 242 4024 E: t.sutton@xxxxxxxxxx <mailto:t.sutton@xxxxxxxxxx> W: www.TBandA.com <http://www.TBandA.com> Eastgate House 10 Eastgate Leeds LS2 7JL Office Location Map <http://www.multimap.com/map/browse.cgi?client=public&db=pc&cidr_clientnone&lang=&pc=LS27JL&advanced=&client=public&addr2=&quicksearch=ls27jl&a ddr3=&addr1=> ________________________________ Groupshield 6.0 - Troup Bywaters & Anders Privilege and Confidentiality Notice This email and any attachments to it are intended only for the party to whom they are addressed. They may contain privileged and / or confidential information. If you have received this transmission in error please notify the sender immediately and delete any digital copies and destroy any paper copies. Thank you. ------------------------------------------------------ List Archives: http://www.webelists.com/cgi/lyris.pl?enter=exchangelist Exchange Newsletters: http://www.msexchange.org/pages/newsletter.asp Exchange FAQ: http://www.msexchange.org/pages/larticle.asp?type=FAQ ------------------------------------------------------ Other Internet Software Marketing Sites: World of Windows Networking: http://www.windowsnetworking.com Leading Network Software Directory: http://www.serverfiles.com No.1 ISA Server Resource Site: http://www.isaserver.org Windows Security Resource Site: http://www.windowsecurity.com/ Network Security Library: http://www.secinf.net/ Windows 2000/NT Fax Solutions: http://www.ntfaxfaq.com ------------------------------------------------------ You are currently subscribed to this MSEXchange.org Discussion List as: michael@xxxxxxxxxx To unsubscribe visit http://www.webelists.com/cgi/lyris.pl?enter=exchangelist Report abuse to listadmin@xxxxxxxxxxxxxx