Create user mailbox account with quota limits

Joined
Mar 28, 2005
Messages
17
Programming Experience
Beginner
Hi everyone,

i am trying to add users to active directory. So far, i have succeeded in creating a new user and setting its properites as follows. How do i create a mailbox account with quota limits for my new user???

I found this article online: http://www.kbalertz.com/Feedback_313114.aspx However, when i add go to add reference for "CDO for Exchange Management (CDOEXM)", i only have the "CDO for Exchange 2000 Library" !!!

Please help. Many many thanks.

VB.NET:
[size=2][color=#0000ff]Try
 
[/color][/size][size=2][color=#0000ff]Dim[/color][/size][size=2] entry [/size][size=2][color=#0000ff]As[/color][/size][size=2][color=#0000ff]New[/color][/size][size=2] DirectoryEntry("LDAP://cn=users,dc=" & myDomain & ",dc=" & myDomainExt, myAdmin, myAdminPswd, AuthenticationTypes.Secure)
[/size][size=2][color=#0000ff]Dim[/color][/size][size=2] myNewUser [/size][size=2][color=#0000ff]As[/color][/size][size=2] DirectoryEntry = entry.Children.Add("cn=" & usrName, "user")
[/size][size=2][color=#008000]'set minimum attributes
[/color][/size][size=2][color=#0000ff]With[/color][/size][size=2] myNewUser.Properties
[/size][size=2].Item("description").Value = usrLastName & "," & usrFirstName & " " & usrMiddleName
.Item("displayNamePrintable").Value = usrName
.Item("distinguishedName").Value = usrName
[/size][size=2].Item("garbageCollPeriod").Value = "86400"
.Item("givenName").Value = usrFirstName
[/size][size=2].Item("mail").Value = usrName & "@" & myDomain & "." & myDomainExt
[/size][size=2].Item("name").Value = usrName
[/size][size=2].Item("physicalDeliveryOfficeName").Value = usrID
.Item("sAMAccountName").Value = usrName
.Item("sn").Value = usrLastName
.Item("userAccountControl").Value = "66048"
.Item("userPrincipalName").Value = usrName & "@" & myDomain & "." & myDomainExt
.Item("displayName").Value = usrFirstName & " " & usrMiddleName & " " & usrLastName
.Item("title").Value = "new"
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]With
[/color][/size][size=2]myNewUser.CommitChanges()
[/size][size=2][color=#008000]'now set password
[/color][/size][size=2]myNewUser.Invoke("SetPassword", [/size][size=2][color=#0000ff]New[/color][/size][size=2][color=#0000ff]String[/color][/size][size=2]() {usrPswd})
myNewUser.CommitChanges()[/size]
 
[size=2][size=5]'now create user's mailbox account[/size]
 
[/size][size=2][color=#0000ff]Catch[/color][/size][size=2] ex [/size][size=2][color=#0000ff]As[/color][/size][size=2] System.Runtime.InteropServices.COMException
MessageBox.Show(ex.ToString)
[/size][size=2][color=#0000ff]End[/color][/size][size=2][color=#0000ff]Try[/color][/size]


 

Latest posts

Back
Top