Share via


Creating a Storage Group

Creating a Storage Group

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 following example creates a storage group. For more information, see the Introduction to Exchange Store Configuration.

Visual Basic

'//////////////////////////////////////////////////////////////////////////////////
'// Name:       CreateNewStorageGroup
'// Purpose:    To create a new storage group with a given name
'// Input:      strSGName = contains name of the new storage group to be created
'//             strComputerName = contains the name of the Exchange 2000 server
'//             strSGUrl (Optional ByRef) = contains the URL to the new storage group created;
'//
'//////////////////////////////////////////////////////////////////////////////////

Public Sub CreateNewStorageGroup(ByVal strSGName As String, _
                                      ByVal strComputerName As String, _
                                      Optional ByRef strSGUrl As String)
    On Error Resume Next
    Dim iServer         As New CDOEXM.ExchangeServer
    Dim iStGroup        As New CDOEXM.StorageGroup
    Dim strTemp         As String

    ' Set the name of the StorageGroup
    iStGroup.Name = strSGName

    ' Bind to the Exchange Server
    iServer.DataSource.Open strComputerName

    'cut out the Storage Group name from URL
    strTemp = iServer.StorageGroups(0)
    strTemp = Mid(strTemp, InStr(2, strTemp, "cn"))
    ' Build the URL to the StorageGroup
    strSGUrl = "LDAP://" & iServer.DirectoryServer & "/CN=" & strSGName & "," & strTemp

    ' Save the StorageGroup
    iStGroup.DataSource.SaveTo strSGUrl

    ' Cleanup
    Set iServer = Nothing
    Set iStGroup = 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.