error '80072020' <== On : "objUser.CreateMailBox

L

lezeou

Hi,

I'm trying to write an ASP page to create a user with an Exchange
Mailbox.
The user is create very well but i've got this error message when i
try to create the mailbox :
error '80072020' <== On : "objUser.CreateMailBox
strHomeMDB"

The string strHomeMDB is good, and the script run perfectly in .vbs
format.

Do you have an idea ?? Thanks

<% @Language=VBScript%>

<%
strFirstName = Request.Form("FirstName")
strLastName = Request.Form("LastName")
struser = Request.Form("Trigramme")
strCompany = Request.Form("Company")
strVille = Request.Form("Ville")

strUserAdmin = "domain\administrator"
strPassword = "xxxxxx"
Const ADS_SECURE_AUTHENTICATION = 1
Const ADS_USE_ENCRYPTION = 2
' Here is where we set the value to enable the account
' 512 = Enable, 514 = Disable.
intAccValue = 512

strServerMail = "XXXXX"
strGroupMail = "XXXXXX"
strServerPerso = "XXXXX"

strDisplayName = UCase(strLastName) & " " & strFirstName
strContainer = "OU=" & strVille & ",OU=" & strCompany &
",OU=_Sociétés,"

' Creation du User
Set objRootLDAP = GetObject("LDAP://" & strServerPerso & "/RootDSE")
Set objDSO = GetObject("LDAP:")
strDNSDomain = objRootLDAP.Get("defaultNamingContext")
strChaine = "LDAP://" & strServerPerso & "/" & strContainer &
strDNSDomain

'------------------------------------------------
response.write strChaine & "<BR>"
'------------------------------------------------

Set objContainer = objDSO.OpenDSObject(strChaine, strUserAdmin,
strPassword, ADS_USE_ENCRYPTION OR ADS_SECURE_AUTHENTICATION)
Set objNewUser = objContainer.Create("User", "CN=" & strDisplayName)

' Personalisation de l'utilisateur
objNewUser.Put "sAMAccountName", LCase(strUser)
objNewUser.Put "givenName", strFirstName
objNewUser.Put "DisplayName", strDisplayName
objNewUser.Put "sn", UCase(strLastName)
objNewUser.Put "initials", UCase(strUser)
objNewUser.Put "company", strCompany
objNewUser.Put "userPrincipalName", LCase(strUser) & "@domain.fr"
objNewUser.SetInfo
objNewUser.setpassword "xxxxxx"
objNewUser.Put "PwdLastSet", 0
objNewUser.SetInfo
objNewUser.Put "userAccountControl", intAccValue
objNewUser.SetInfo
objNewUser.accountdisabled = FALSE
objNewUser.SetInfo

'Creation de la Boite aux Lettres
MStore = "LDAP://CN=Banque de boîtes aux lettres (" & strServerMail &
")" &_
",CN=Premier groupe de stockage" &_
",CN=InformationStore" &_
",CN=" & strServerMail &_
",CN=Servers" &_
",CN=" & strGroupMail &_
",CN=Administrative Groups,CN=XXXXX,CN=Microsoft
Exchange,CN=Services,CN=Configuration," & strDNSDomain

objNewUser.SetInfo
Set objMailbox = objNewUser

objMailbox.CreateMailbox MStore
objNewUser.SetInfo

%>
 
T

ThatsIT.net.au

Hi,

I'm trying to write an ASP page to create a user with an Exchange
Mailbox.
The user is create very well but i've got this error message when i
try to create the mailbox :
error '80072020' <== On : "objUser.CreateMailBox
strHomeMDB"

The string strHomeMDB is good, and the script run perfectly in .vbs
format.

Do you have an idea ?? Thanks


a permissions problem i would say




<% @Language=VBScript%>

<%
strFirstName = Request.Form("FirstName")
strLastName = Request.Form("LastName")
struser = Request.Form("Trigramme")
strCompany = Request.Form("Company")
strVille = Request.Form("Ville")

strUserAdmin = "domain\administrator"
strPassword = "xxxxxx"
Const ADS_SECURE_AUTHENTICATION = 1
Const ADS_USE_ENCRYPTION = 2
' Here is where we set the value to enable the account
' 512 = Enable, 514 = Disable.
intAccValue = 512

strServerMail = "XXXXX"
strGroupMail = "XXXXXX"
strServerPerso = "XXXXX"

strDisplayName = UCase(strLastName) & " " & strFirstName
strContainer = "OU=" & strVille & ",OU=" & strCompany &
",OU=_Sociétés,"

' Creation du User
Set objRootLDAP = GetObject("LDAP://" & strServerPerso & "/RootDSE")
Set objDSO = GetObject("LDAP:")
strDNSDomain = objRootLDAP.Get("defaultNamingContext")
strChaine = "LDAP://" & strServerPerso & "/" & strContainer &
strDNSDomain

'------------------------------------------------
response.write strChaine & "<BR>"
'------------------------------------------------

Set objContainer = objDSO.OpenDSObject(strChaine, strUserAdmin,
strPassword, ADS_USE_ENCRYPTION OR ADS_SECURE_AUTHENTICATION)
Set objNewUser = objContainer.Create("User", "CN=" & strDisplayName)

' Personalisation de l'utilisateur
objNewUser.Put "sAMAccountName", LCase(strUser)
objNewUser.Put "givenName", strFirstName
objNewUser.Put "DisplayName", strDisplayName
objNewUser.Put "sn", UCase(strLastName)
objNewUser.Put "initials", UCase(strUser)
objNewUser.Put "company", strCompany
objNewUser.Put "userPrincipalName", LCase(strUser) & "@domain.fr"
objNewUser.SetInfo
objNewUser.setpassword "xxxxxx"
objNewUser.Put "PwdLastSet", 0
objNewUser.SetInfo
objNewUser.Put "userAccountControl", intAccValue
objNewUser.SetInfo
objNewUser.accountdisabled = FALSE
objNewUser.SetInfo

'Creation de la Boite aux Lettres
MStore = "LDAP://CN=Banque de boîtes aux lettres (" & strServerMail &
")" &_
",CN=Premier groupe de stockage" &_
",CN=InformationStore" &_
",CN=" & strServerMail &_
",CN=Servers" &_
",CN=" & strGroupMail &_
",CN=Administrative Groups,CN=XXXXX,CN=Microsoft
Exchange,CN=Services,CN=Configuration," & strDNSDomain

objNewUser.SetInfo
Set objMailbox = objNewUser

objMailbox.CreateMailbox MStore
objNewUser.SetInfo

%>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top