ad目录中添加用户属性
2005-09-28 01:26
471 查看
Sub ADSICreateMailBoxRecipient(MDBName As String, _
StorageGroup As String, _
Server As String, _
AdminGroup As String, _
Organization As String, _
DomainName As String, _
emailname As String, _
FirstName As String, _
LastName As String)
'MDBName is something like "MyMDB6"
'DomainName is something like "DC=MYDOMAIN3,DC=microsoft,DC=com"
'emailname is something like "jamessmith"
'this assumes the MDB to be a mailbox store.
Dim objUser As IADsUser
Dim objContainer As IADsContainer
Dim objMailbox As CDOEXM.IMailboxStore
Dim recipname As String, recip As String
recip = "CN=" & emailname
' get the container
Set objContainer = GetObject("LDAP://CN=users," + DomainName)
' create a recipient
Set objUser = objContainer.Create("User", recip)
objUser.Put "samAccountName", emailname
objUser.Put "sn", LastName
objUser.Put "givenName", FirstName
objUser.Put "userPrincipalName", emailname
====
dim sSlary
objUser.Put "extensionattribute1",sSlary
objUser.SetInfo
objUser.SetPassword "password" 'let user change it later
objUser.AccountDisabled = False
Set objMailbox = objUser
'Create a mailbox for the recipient
'You cannot create a mailbox using ADSI, so use CDOEXM
objMailbox.CreateMailbox "LDAP://CN=" + MDBName + _
",CN=" + StorageGroup + _
",CN=InformationStore" + _
",CN=" + Server + _
",CN=Servers" + _
",CN=" + AdminGroup + _
",CN=Administrative Groups" + _
",CN=" + Organization + _
",CN=Microsoft Exchange,CN=Services" + _
",CN=Configuration," + DomainName
objUser.SetInfo
End Sub
StorageGroup As String, _
Server As String, _
AdminGroup As String, _
Organization As String, _
DomainName As String, _
emailname As String, _
FirstName As String, _
LastName As String)
'MDBName is something like "MyMDB6"
'DomainName is something like "DC=MYDOMAIN3,DC=microsoft,DC=com"
'emailname is something like "jamessmith"
'this assumes the MDB to be a mailbox store.
Dim objUser As IADsUser
Dim objContainer As IADsContainer
Dim objMailbox As CDOEXM.IMailboxStore
Dim recipname As String, recip As String
recip = "CN=" & emailname
' get the container
Set objContainer = GetObject("LDAP://CN=users," + DomainName)
' create a recipient
Set objUser = objContainer.Create("User", recip)
objUser.Put "samAccountName", emailname
objUser.Put "sn", LastName
objUser.Put "givenName", FirstName
objUser.Put "userPrincipalName", emailname
====
dim sSlary
objUser.Put "extensionattribute1",sSlary
objUser.SetInfo
objUser.SetPassword "password" 'let user change it later
objUser.AccountDisabled = False
Set objMailbox = objUser
'Create a mailbox for the recipient
'You cannot create a mailbox using ADSI, so use CDOEXM
objMailbox.CreateMailbox "LDAP://CN=" + MDBName + _
",CN=" + StorageGroup + _
",CN=InformationStore" + _
",CN=" + Server + _
",CN=Servers" + _
",CN=" + AdminGroup + _
",CN=Administrative Groups" + _
",CN=" + Organization + _
",CN=Microsoft Exchange,CN=Services" + _
",CN=Configuration," + DomainName
objUser.SetInfo
End Sub
相关文章推荐
- AD用户属性项目添加
- 活动目录用户属性与AD字段对照表
- AD添加用户时,提示“目录服务已经用完相对标识符池”
- 活动目录用户属性与AD字段对照表
- 活动目录AD 取用户过期时间accountExpires
- 批量修改AD用户属性
- [ASP.NET开发系列]在用户控件中添加属性 -- 摘自 tigerwen01
- 在asp.net中为Web用户控件添加属性和事件
- [ASP.NET开发系列]在用户控件中添加属性
- AD 用户属性userAccountControl的详细解释
- Ubuntu 添加新用户并制定目录和shell,并配置为root组用户|sudoer 修改
- 1.5.2 添加一个用户lidao指定uid为888 禁止用户登录系统 不创建家目录
- 使用目录服务和 Visual C# .NET 向本地系统添加用户
- 学习在活动目录中一次同时添加多个用户帐户
- 【解决】Win2003中AD的用户的拨入属性无法打开
- 为用户控件添加属性
- 发一个取AD用户属性的自定义字段
- 【安装oracle——准备工作】配置内核参数+添加用户组及用户+为oracle用户配置shell限制+创建目录结构+设置oracle环境
- AD开发用户(User)属性完全手册(AD User)
- Magento 目录添加自定义属性例子