VB中创建一工程
并引用
Active DS Type Library
Microsoft CDO for Exchange 2000 Library
Microsoft CDO 1.21 Library
Microsoft CDO for Exchange Management Library
Microsoft CDO for NTS 1.2 Library
Microsoft CDO Workflow Objects for Microsoft Exchange
我公司的主域控制器为admin.kc.com
域为kc.com
Exchange 2000 前端与后台均安装在主域控制器admin.kc.com上。
Exchange 2000组织为 First Organization
szAdminGroup 为 First Administrative Group
szStorageGroup 为 First Storage Group'//////////////////////////////////////////////////////////////////////' Function: createUserThroughADSI()' Purpose:  Creates a user in the specified organization, assigns an OAB,'           sets their Outlook Web Access search criteria, and creates a mailbox.  This function'           uses ADSI to create the user.'' Input:    szServerName:           Name of exchange server'           szdomainName:           Domain of user'           szExchangeOrg:          Name of exchange organization'           szAdminGroup:           Name of exchange admin group'           szStorageGroup:         Name of exchange storage group'           szstoreName:            Name of the store mailbox is to be created in'           szAlias:                Alias of user'           szFirstName:            First name of user'           szLastName:             Last name of user'           szPassword:             User's password'           szHostingOrgName:       Name of hosting container in the DS'           szHostingOrgDomain:     SMTP suffix of user's org'           szOrganizationalUnit:   Name of users org'           szGroupName:            Name of group to add user to'           szDirectoryServer:      Name of the Directory Server'           szAdminUserName:        Administrator user name'           szAdminPassword:        Administrator password'' Output:   createUserThroughADSI:   Contains Error code (if any)'//////////////////////////////////////////////////////////////////////Public Function createUserThroughADSI(ByVal szServerName As String, ByVal szDomainName As String, ByVal szExchangeOrg As String, ByVal szAdminGroup As String, ByVal szStorageGroup As String, ByVal szstoreName As String, ByVal szAlias As String, ByVal szFirstName As String, ByVal szLastName As String, ByVal szPassword As String, ByVal szHostingOrgName As String, ByVal szHostingOrgDomain As String, ByVal szOrganizationalUnit As String, ByVal szGroupName As String, ByVal szDirectoryServer As String, ByVal szAdminUserName As String, ByVal szAdminPassword As String) As Integer
'Call createUserThroughADSI("admin", "kc.com","First Organization", "Exchange Domain Servers", "", "liulin", "liulin", "liulin", "liulin", "liulin", "admin", "kc.com", "kc.com", "", "admin", "Administrator", "")    Dim objPerson As IADsUser    Dim objContainer As IADsContainer    Dim objMailbox As CDOEXM.IMailboxStore    Dim szConnString As String    Dim szOABlocation As String    Dim szLdapDomain As String    Dim szSAMAccountName As String    Dim szaDomTokens() As String    Dim szDomainDN As String    On Error GoTo errhandler    ' Puts the domain specified into an ldap domain string.    szaDomTokens = Split(szDomainName, ".", -1, 1)    szDomainDN = Join(szaDomTokens, ",dc=")    szDomainDN = "dc=" & szDomainDN    szLdapDomain = szDomainDN    ' Build the LDAP path necessary to create the user.    szConnString = "LDAP://" + szDirectoryServer + "/" + "OU=" + szOrganizationalUnit + ",OU=" + szHostingOrgName + "," + szLdapDomain    ' Build the necessary LDAP path to this users's OAB's.    szOABlocation = "cn=" + szOrganizationalUnit + ",cn=Offline Address Lists,cn=Address Lists Container,cn=" + szExchangeOrg + ",cn=Microsoft Exchange,cn=Services,cn=Configuration," + szLdapDomain    Set objContainer = GetObject(szConnString)    Set objPerson = objContainer.Create("User", "cn=" + szAlias)    szSAMAccountName = szAlias + "@" + szHostingOrgDomain    If Len(szSAMAccountName) > 20 Then        szSAMAccountName = Mid(szSAMAccountName, 1, 20)    End If    With objPerson        .FirstName = szFirstName        .LastName = szLastName        .Put "sAMAccountName", szSAMAccountName        .Put "userPrincipalName", szAlias + "@" + szHostingOrgDomain        .Put "userAccountControl", 66048 ' set password doesn't expire        .Put "msexchQueryBaseDN", "OU=" + szOrganizationalUnit + "," + "OU=" + szHostingOrgName + "," + szLdapDomain        .Put "mailNickname", szAlias        .Put "msExchUseOAB", szOABlocation        .SetInfo        .SetPassword szPassword        .AccountDisabled = False        .SetInfo        Set objMailbox = objPerson        objMailbox.CreateMailbox "LDAP://" + szDirectoryServer + "/CN=" + szstoreName + ",CN=" + szStorageGroup + ",CN=InformationStore,CN=" + szServerName + ",CN=Servers,CN=" + szAdminGroup + ",CN=Administrative Groups,CN=" + szExchangeOrg + ",CN=Microsoft Exchange,CN=Services,CN=Configuration," + szLdapDomain        .EmailAddress = szAlias + "@" + szHostingOrgDomain        .SetInfo    End With    ' See if a group name was passed in.  If so, add this user to that group.    If szGroupName <> "" Then'        addUserToGroup szDomainName, szAlias, szGroupName, szHostingOrgName, szOrganizationalUnit, szHostingOrgDomain, True, szAdminUserName, szAdminPassword, szDirectoryServer
    End If    createUserThroughADSI = 0    ' Clean up.    Set objPerson = Nothing    Set objMailbox = Nothing    Set objContainer = Nothing    Exit Function    ' Error handling.errhandler:    createUserThroughADSI = 1    Set objPerson = Nothing    Set objMailbox = Nothing    Set objContainer = Nothing    'Implement error logging here.End Function
请问该函数中以下17个参数的含义,及我应该怎么设置:' Input:    szServerName:           Name of exchange server'           szdomainName:           Domain of user'           szExchangeOrg:          Name of exchange organization'           szAdminGroup:           Name of exchange admin group'           szStorageGroup:         Name of exchange storage group'           szstoreName:            Name of the store mailbox is to be created in'           szAlias:                Alias of user'           szFirstName:            First name of user'           szLastName:             Last name of user'           szPassword:             User's password'           szHostingOrgName:       Name of hosting container in the DS'           szHostingOrgDomain:     SMTP suffix of user's org'           szOrganizationalUnit:   Name of users org'           szGroupName:            Name of group to add user to'           szDirectoryServer:      Name of the Directory Server'           szAdminUserName:        Administrator user name'           szAdminPassword:        Administrator password非常感谢!