当前位置:编程问答 > asp >

asp如何创建一个Exchange用户?

答案:

<%@ Language=VBScript %>
<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 7.0">
</HEAD>
<BODY>
<%
    Dim objUser
    Dim objContainer
    Dim objMailbox
   
    Dim recipname, recip
    Dim ServerName, DomainName, emailname, FirstName, LastName, password
   
    ServerName = "intels.net"
    DomainName = "DC=intels,DC=net"
    emailname = "liyanbing"
    password = "3625"
    recip = "CN=" & emailname
    LastName = "Yanbing"
    FirstName = "Li"
   
    Set objContainer = GetObject("LDAP://" & ServerName & "/OU=intels.net," & DomainName)

    Set objUser = objContainer.Create("User", recip)
    objUser.Put "samAccountName", emailname
    objUser.Put "sn", LastName
    objUser.Put "givenName", FirstName
    objUser.Put "DisplayName", "liyanbing@intels.net"
    objUser.Put "userPrincipalName", emailname & "@intels.net"
    objUser.SetInfo
   
    objUser.SetPassword password
    objUser.AccountDisabled = False
    objUser.SetInfo

    Set objMailbox = objUser

    objMailbox.CreateMailbox "LDAP://intels.net/CN=Mailbox Store (intels),CN=First Storage Group,CN=InformationStore,CN=chunfeng,CN=Servers,CN=First Administrative Group,CN=Administrative Groups,CN=ecitye,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=intels,DC=net"
    objUser.SetInfo
   
    Set objContainer = Nothing
    Set objUser = Nothing
    Set objMailbox = Nothing
   
    if err <> 0 then
        Response.Write "对不起,创建失败!"
    else
        Response.Write "恭喜,创建成功!"
    end if
%>
</BODY>
</HTML>


 

上一个:如何调用DLL来加快服务器的执行速度?
下一个:asp如何断开recordset,提高运行速度?

CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,