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

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

am 10.05.2007 22:03:43 von 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=3DVBScript%>

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

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

strServerMail =3D "XXXXX"
strGroupMail =3D "XXXXXX"
strServerPerso =3D "XXXXX"

strDisplayName =3D UCase(strLastName) & " " & strFirstName
strContainer =3D "OU=3D" & strVille & ",OU=3D" & strCompany &
",OU=3D_Soci=E9t=E9s,"

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

'------------------------------------------------
response.write strChaine & "
"
'------------------------------------------------

Set objContainer =3D objDSO.OpenDSObject(strChaine, strUserAdmin,
strPassword, ADS_USE_ENCRYPTION OR ADS_SECURE_AUTHENTICATION)
Set objNewUser =3D objContainer.Create("User", "CN=3D" & 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 =3D FALSE
objNewUser.SetInfo

'Creation de la Boite aux Lettres
MStore =3D "LDAP://CN=3DBanque de bo=EEtes aux lettres (" & strServerMail &
")" &_
",CN=3DPremier groupe de stockage" &_
",CN=3DInformationStore" &_
",CN=3D" & strServerMail &_
",CN=3DServers" &_
",CN=3D" & strGroupMail &_
",CN=3DAdministrative Groups,CN=3DXXXXX,CN=3DMicrosoft
Exchange,CN=3DServices,CN=3DConfiguration," & strDNSDomain

objNewUser.SetInfo
Set objMailbox =3D objNewUser

objMailbox.CreateMailbox MStore
objNewUser.SetInfo

%>

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

am 11.05.2007 18:29:39 von me

wrote in message
news:1178827423.299234.58480@l77g2000hsb.googlegroups.com...
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 & "
"
'------------------------------------------------

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

%>