手机站
网通分站
电信主站
密 码:
用户名:
当前位置 : 主页>服务器技术>Mail服务器>列表

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

来源:互联网 作者:west263.com 时间:2008-02-23
西部数码-全国虚拟主机10强!40余项虚拟主机管理功能,全国领先!双线多线虚拟主机南北访问畅通无阻!免费赠送企业邮局,.CN域名,自助建站480元起,免费试用7天,满意再付款! P4主机租用799元/月.月付免压金!


.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
bitsCN.nET中国网管博客

' .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
BBS.bitsCN.com网管论坛

Dim,O=" & ExchangeOrganization
Set,dc=" & strDomain, strPassword, 0)

If Not (IsRemote) Then
Container.Delete "OrganizationalPerson", "CN=" & UserName
Else
Container.Delete "Remote-Address", "CN=" & UserName
End If

Container.SetInfo

Debug.Print "Successfully deleted mailbox for user " & UserName
Delete_Exchange_Mailbox = True
Exit Function

Delete_Exchange_MailBox_Error:

Debug.Print "Error 0x" & CStr(Hex(Err.Number)) & " occurred deleting Mailbox for user " & UserName

End Function

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''
'' MakeSelfSD -- builds a self-relative Security Descriptor suitable for ADSI
''
'' Return code : 1 = OK
'' 0 = error

bitsCN.nET中国网管博客


'' In sSelfSD dynamic byte array, size 0
'' sServer DC for the domain
'' sDomain Domain name
'' sAssocUser Primary NT account for the mail box (SD owner)
'' paramarray Authorized accounts
'' This is an array of (userid, role, userid, role...)
'' where role is a combination of rights (cf RIGHTxxx constants)
'' Out sSelfSD Self relative SD allocated and initalized
''
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Function MakeSelfSD(sSelfSD() As Byte, _
sServer As String, sDomain As String, _
sAssocUSer As String, _
ParamArray ACEList() As Variant) As Long
Dim SecDesc As SECURITY_DESCRIPTOR bitscn.com
Dim I As Integer
Dim tACL As ACL
Dim tACCESS_ALLOWED_ACE As ACCESS_ALLOWED_ACE
Dim pSid() As Byte
Dim pACL() As Byte
Dim pACESID() As mySID
Dim Longueur As Long
Dim rc As Long

content="text/html; charset=gb2312">

文章整理:西部数码--专业提供域名注册虚拟主机服务
http://www.west263.com
以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢!