基于ADSI的NT帐号及Exchange Server帐号申请及验证模块源代码[5]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 zhengsb 的 blog

       
        .put "rfc822mailbox", username & "@" & exchangesite & "." & exchangeorganization & ".com"
        .put "replication-sensitivity", replication_sensitivity
        .put "uid", username
        .put "name", username

      '  .put "givenname", strfirstname
      '  .put "sn", strlastname
        .put "cn", strrealname 'strfirstname & " " & username 'strlastname
      '  .put "initials", mid(strfirstname, 1, 1) & mid(strlastname, 1, 1)
       
        ' any of these fields are simply descriptive and optional, not included in
        ' this sample and there are many other fields in the mailbox
        .put "mail", emailaddress
        'if 0 < len(direction) then .put "department", direction
        'if 0 < len(faxnumber) then .put "facsimiletelephonenumber", faxnumber
        'if 0 < len(city) then .put "l", city
        'if 0 < len(address) then .put "postaladdress", address
        'if 0 < len(postalcode) then .put "postalcode", postalcode
        'if 0 < len(banque) then .put "company", banque
        'if 0 < len(phonenumber) then .put "telephonenumber", phonenumber
        'if 0 < len(title) then .put "title", title
        'if 0 < len(ap1) then .put "extension-attribute-1", ap1
        'if 0 < len(manager) then .put "extension-attribute-2", manager
        'if 0 < len(agence) then .put "extension-attribute-3", agence
        'if 0 < len(groupe) then .put "extension-attribute-4", groupe
        'if 0 < len(secteur) then .put "extension-attribute-5", secteur
        'if 0 < len(region) then .put "extension-attribute-6", region
        'if 0 < len(groupebanque) then .put "extension-attribute-7", groupebanque
        'if 0 < len(ap7) then .put "extension-attribute-8", ap7
        'if 0 < len(ap8) then .put "extension-attribute-9", ap8
        .setinfo
    end with
   
    debug.print "successfully created mailbox for user " & username
    create_exchange_mailbox = true
    exit function

create_exchange_mailbox_error:
    create_exchange_mailbox = false
    debug.print "error 0x" & cstr(hex(err.number)) & " occurred creating mailbox for user " & username
   
end function

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''
'' delete_exchange_mailbox() -- deletes an exchange mailbox
''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
public function delete_exchange_mailbox( _
    isremote as boolean, _
    strdomain as string, _
    stradmin as string, _
    strpassword as string, _
    username as string, _
    exchangeserver as string, _
    exchangesite as string, _
    exchangeorganization as string _
  ) as boolean

dim strrecipcontainer as string
dim container as iadscontainer
dim ons as iadsopendsobject

    if (strpassword = "") then
        strpassword = ""
    end if

    on error goto delete_exchange_mailbox_error
    delete_exchange_mailbox = false
   
    ' recipients container for this server
    strrecipcontainer = "ldap://" & exchangeserver & _
                        "/cn=recipients,ou=" & exchangesite & _
                        ",o=" & exchangeorganization
    set ons = getobject("ldap:")
    set container = ons.opendsobject(strrecipcontainer, "cn=" & stradmin & ",dc=" & strdomain, strpassword, 0)

    if not (isremote) then
        container.delete "organizationalperson", "cn=" & username
    else
        container.delete "remote-address", "cn=" & username
    end if
   
    container.setinfo
   

本文关键:ADSI NT Exchange 帐号
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top