Recipe 6.5. Creating a Public Folder DatabaseProblemYou want to create an additional public folder database to host your applications. SolutionUsing a graphical user interfaceTo create an additional public folder hierarchy, do the following:
To create an additional public folder database, do the following:
Using VBScript' This code creates an additional public folder tree and a database within it, ' then mounts the new database ' ------ SCRIPT CONFIGURATION ------ strServerName = "<serverName>" ' e.g., "BATMAN" strPFDBName = "<newDBName>" ' e.g., "SpiffyNewPFDatabase01" strPFTreeName = "<newTreeName>" ' New PF Tree strAdminGroup = "<yourAdminGroupName>" ' e.g., "First Administrative Group" strOrgName = "<yourOrgName>" ' e.g., "First Organization" strDomain = "dc=contoso,dc=local" ' ------ END CONFIGURATION --------- Set theServer = CreateObject("CDOEXM.ExchangeServer") Set theNewTree = CreateObject("CDOEXM.FolderTree") Set theDSE = GetObject("LDAP://RootDSE") Set thePFDB = CreateObject("CDOEXM.PublicStoreDB") ' create the public tree. You could dynamically get the AG and org ' name but for simplicity we're defining them statically strTreeURL = "LDAP://CN=" & strPFTreeName & ",CN=Folder Hierarchies" & _ ",CN=" & strAdminGroup & ",CN=Administrative Groups,CN=" & strOrgName & _ ",CN=Microsoft Exchange,CN=Services,CN=Configuration," & _ theDSE.Get("defaultnamingcontext") theNewTree.name = strPFTreeName theNewTree.DataSource.SaveTo strTreeURL thePFDB.Name = strPFDBName thePFDB.FolderTree = strTreeURL ' Get the first SG theServer.DataSource.Open strServerName arrSG = theServer.StorageGroups theFirstSG = sg Exit for Next ' Create the URL to the new PF, then create and mount it strPFURL = "LDAP://" & theServer.DirectoryServer & "/CN=" & strPFDBName & "," & _ theFirstSG thePFDB.DataSource.SaveTo strPFURL thePFDB.Mount DiscussionExchange 2000 and 2003 support multiple public folder hierarchies (also known as top-level hierarchies (TLHs) or public folder trees). When you initially install Exchange 2000 or Exchange Server 2003 Server's, you automatically get a TLH that's accessible to MAPI clients; this is where user-accessible public folders are stored. There's a catch, though: there can be only one TLH accessible to MAPI clients. Clients that use NNTP or the WebDAV extensions to HTTP can use non-MAPI TLHs, but you must first create at least one non-MAPI TLH before you can add more than one public folder store to a SG. If you don't have a public store at all, when you create one, it's automatically associated with the default MAPI TLH. Using VBScriptThe code creates a public folder tree in the Exchange organization's Folder Hierarchies object by instantiating a new CDOEXM.FolderTree object and settings its URL to the specified name, along with the rest of the standard folder hierarchies' tree name. Once the tree is created, the script locates the first SG and uses its URL as the base to create a new public folder database in the new tree. See AlsoRecipe 9.5 for forcing replication of a public folder hierarchy, Recipe 9.6 for getting properties of a public folder tree, Recipe 9.7 for creating and removing public folders, and MS KB 255077 (HOW TO: Create a New Public Folder Tree and Store in Exchange) |