Share via


Creating an HTTP Virtual Directory on an HTTP Virtual Server

Creating an HTTP Virtual Directory on an HTTP Virtual Server

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 an HTTP virtual directory on an HTTP virtual server. The example uses functions for Getting a List of All Servers in the Administrative Group, Getting the Entry ID of a Virtual Server Using Its Name, and Creating an HTTP Virtual Directory.

Visual Basic

'//////////////////////////////////////////////////////////////////////
' Function: commitDirectory()
' Purpose:  Creates an HTTP virtual Directory on an HTTP virtual server.
'
' Input:    szHostingDomainName:        Name of the Hosting organization.
'           szVirtualServerName:        Name of the server this directory is to be added to.
'           szVirtualDirectoryName:     The name of this virtual directory.
'           szVirtualDirectoryPath:     The IFS path that this directory will point to.
'           szDefaultLogonDomain:       The value for the default logon domain.
'           szDomainName:               Domain of the Exchange organization.
'           szOrganizationName:         Name of the Exchange organization.
'           szAdministrativeGroupName:  Name of the Administrative group.
'           szUserName:                 Administrator username.
'           szUserPwd:                  Administrator password.
'
' Output:   None
'
' 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.
'//////////////////////////////////////////////////////////////////////
Private Sub commitDirectory(ByVal szHostingDomainName As String, _
                            ByVal szVirtualServerName As String, _
                            ByVal szVirtualDirectoryName As String, _
                            ByVal szVirtualDirectoryPath As String, _
                            ByVal szDefaultLogonDomain As String, _
                            ByVal szDomainName As String, _
                            ByVal szOrganizationName As String, _
                            ByVal szAdministrativeGroupName As String, _
                            ByVal szUserName As String, _
                            ByVal szUserPwd As String)

    Dim szServers As String
    Dim szCurrentServer As String
    Dim szaServerList() As String
    Dim szEntryID As String
    Dim iCounter As Integer

    ' Check the input parameters.
    If szHostingDomainName = "" Or szVirtualServerName = "" Or szVirtualDirectoryName = "" _
        Or szDefaultLogonDomain = "" Or szDomainName = "" Or szOrganizationName = "" _
        Or szAdministrativeGroupName = "" Or szUserName = "" Or szUserPwd = "" Then
        Exit Sub
    End If

    'Get a list of the installed servers.
    getInstalledServerList szDomainName, _
                           szOrganizationName, _
                           szAdministrativeGroupName, _
                           szUserName, _
                           szUserPwd, _
                           szServers

    szaServerList = Split(szServers, ";", -1, 1)

    ' For each installed server, get the entry ID for the virtual server.
    For iCounter = 0 To UBound(szaServerList)
        szCurrentServer = szaServerList(iCounter)

        getEntryIDfromName szDomainName, _
                           szOrganizationName, _
                           szAdministrativeGroupName, _
                           szCurrentServer, _
                           szVirtualServerName, _
                           szUserName, _
                           szUserPwd, _
                           szEntryID

        ' Add the directory to the virtual server.
        createHTTPVirtualDirectory szDomainName, _
                                   szOrganizationName, _
                                   szAdministrativeGroupName, _
                                   szCurrentServer, _
                                   szEntryID, _
                                   szDefaultLogonDomain, _
                                   szVirtualDirectoryName, _
                                   szVirtualDirectoryPath, _
                                   szHostingDomainName, _
                                   szUserName, _
                                   szUserPwd
    Next

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.