Share via


Getting a List of All Installed HTTP Virtual Directories

Getting a List of All Installed HTTP Virtual Directories

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 returns a list of every HTTP virtual directory on a specified virtual server. The example uses a function for Getting a List of Objects In a Container

Visual Basic

'//////////////////////////////////////////////////////////////////////
' Function: getInstalledVirtualServerDirectoryList()
' Purpose:  Returns a list of all HTTP virtual directories on a
'           specified virtual server.
'
' Input:    szDomainName:               Domain of the exchange organization
'           szOrganizationName:         Name of Exchange Organization
'           szAdministrativeGroupName:  Name of Administrative Group
'           szServerName:               Name of server to enumerate
'           szEntryid:                  Entry ID of Virtual Server
'           szUserName:                 Admin Username
'           szUserPwd:                  Admin pwd
'           szDirectoryServer:          Name of the Directory Server
'
' Output:   getInstalledVirtualServerDirectoryList:   Contains Error code (if any)
'           szServerList:               List of installed directories
'
' Note:  In order for this example to function correctly, it may be necessary to include
' references to the following libraries: Active DS Type Library, Microsoft CDO for
' Exchange Management Library, Microsoft Cluster Service Automation Classes,
' Microsoft CDO for Windows 2000 Library.
'//////////////////////////////////////////////////////////////////////
Public Function getInstalledVirtualServerDirectoryList(ByVal szDomainName As String, _
                                                       ByVal szOrganizationName As String, _
                                                       ByVal szAdministrativeGroupName As String, _
                                                       ByVal szServerName As String, _
                                                       ByVal szEntryID As String, _
                                                       ByVal szUserName As String, _
                                                       ByVal szUserPwd As String, _
                                                       ByRef szDirectoryList As String, _
                                                       ByVal szDirectoryServer) As Integer

    Dim szConnString As String
    Dim szaDomTokens() As String
    Dim szDomainDN As String

    On Error GoTo errhandler

    ' Put the domain name into an ldap string.
    szaDomTokens = Split(szDomainName, ".", -1, 1)
    szDomainDN = Join(szaDomTokens, ",dc=")
    szDomainDN = "dc=" & szDomainDN

    ' Build up the ldap connection string.

    szConnString = "LDAP://" + szDirectoryServer + "/cn=" + _
                   szEntryID + ",cn=http,cn=protocols,cn=" + szServerName + _
                   ",cn=servers,cn=" + szAdministrativeGroupName + _
                   ",cn=Administrative Groups,cn=" + szOrganizationName + _
                   ",cn=Microsoft Exchange,cn=services,cn=configuration," + _
                   szDomainDN

    ' Get a list of the msExchProtocolCfgHTTPVirtualDirectory objects on the virtual server.
    getObjectList szUserName, _
                  szUserPwd, _
                  szConnString, _
                  "msExchProtocolCfgHTTPVirtualDirectory", _
                  szDirectoryList

    getInstalledVirtualServerDirectoryList = 0
    Exit Function

   ' Error handling.
errhandler:

    getInstalledVirtualServerDirectoryList = 1
    ' Implement error logging here.
    Exit Function

End Function

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.