Deleting a Public Store
Deleting a Public Store
This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.
The code in the following example deletes a public store in a storage group. The function searches the server for the specified storage group from which to delete the public store.
Visual Basic
'////////////////////////////////////////////////////////////////////////////////// '// Name: DeletePublicStore '// Purpose: To delete a PublicStoreDB with a given name '// Input: strPSName = contains the name of the PublicStoreDB to be deleted '// strComputerName = contains the name of the Exchange 2000 server '// strSGName (Optional) = contains the name of the storage group where PublicStoreDB is located; '// if it is empty then Storage Group will be considered the first one in the list '// '// Notes: It is not necessary to dismount the store. The store will automatically be '// dismounted before deletion. '// '////////////////////////////////////////////////////////////////////////////////// Sub DeletePublicStore(ByVal strPSName As String, _ ByVal strComputerName As String, _ Optional ByVal strSGName As String) Dim iServer As New CDOEXM.ExchangeServer Dim iPbStoreDB As New CDOEXM.PublicStoreDB Dim arrStGroup() Dim i As Integer Dim strTemp As String Dim strFolderURL As String Dim strFHName As String Dim strPSUrl As String ' Bind to the Exchange Server iServer.DataSource.Open strComputerName ' Set the variant array to the array of StorageGroups from Server object arrStGroup = iServer.StorageGroups ' Start to build the URL to the PublicStore - first part strTemp = "LDAP://" & iServer.DirectoryServer & "/CN=" & strPSName & "," ' Verify if the StorageGroup strSGName exist in the StorageGroups array If strSGName = "" Then ' Finish to build the URL to the PublicStoreDB - add last part strPSUrl = strTemp & iServer.StorageGroups(0) Else For i = 0 To UBound(arrStGroup) If InStr(1, arrStGroup(i), strSGName) <> 0 Then ' Finish to build the URL to the PublicStoreDB - add last part strPSUrl = strTemp & arrStGroup(i) End If Next End If ' Bind to the PublicStoreDB iPbStoreDB.DataSource.Open strPSUrl ' Delete the PublicStoreDB iPbStoreDB.DataSource.Delete ' Cleanup Set iServer = Nothing Set iPbStoreDB = Nothing End Sub
Send us your feedback about the Microsoft Exchange Server 2003 SDK.
Build: June 2007 (2007.618.1)
© 2003-2006 Microsoft Corporation. All rights reserved. Terms of use.