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

Discussion in 'ASP General' started by lezeou@hotmail.com, May 10, 2007.

  1. Guest

    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

    %>
     
    , May 10, 2007
    #1
    1. Advertising

  2. <> wrote in message
    news:...
    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

    %>
     
    ThatsIT.net.au, May 11, 2007
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?TWFuZHk=?=

    CDOEXM.IMailboxStore.CreateMailbox Error

    =?Utf-8?B?TWFuZHk=?=, Feb 2, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    2,980
    =?Utf-8?B?TWFuZHk=?=
    Feb 2, 2005
  2. hfk0
    Replies:
    2
    Views:
    21,706
  3. JavaQueries
    Replies:
    1
    Views:
    3,710
    John C. Bollinger
    Mar 1, 2005
  4. Balaji
    Replies:
    3
    Views:
    10,140
  5. JP SIngh

    How to trap error '80072020'

    JP SIngh, Jul 13, 2006, in forum: ASP General
    Replies:
    2
    Views:
    335
    Bob Barrows [MVP]
    Jul 13, 2006
Loading...

Share This Page