|
 |
asp_cdo thread: probleme to create a mail box with exchange 2000 using script
Message #1 by mohbouraoui@y... on Mon, 27 May 2002 17:11:23
|
|
i'm trying to create new mailbox in exchange 2000. i can create a user in
the active directory using CDOEX, but i can't create mailbox and generate
me errors in line 48 and 60 (i use asp for creating new email) :
the is the script when i use :
<%@ Language=VBScript %>
<%
Dim strServerName ' the server name, for
example "MyServer6"
Dim strDomainName ' the server's domain, for
example "MYDOMAIN3.microsoft.com"
Dim strExchangeOrg ' the Exchange organization
housing the mailbox store. For example "First Organization"
Dim strAdminGroup ' the Exchange administrative
group name, for example "First Administrative Group"
Dim strStorageGroup ' the storage group for the
mailbox store, for example "First Storage Group"
Dim strStoreName ' the mailbox store name, for
example "Mailbox Store (SERVERNAME)"
Dim strEmailName ' emailname - the user's email
name, for example "jamessmith"
Dim strFirstName ' the user's first name, for
example "James"
Dim strLastName ' the user's last name, for
example "Smith"
Dim objPerson ' object to hold CDO person object
Dim objMailbox ' object to hold IMailboxStore
interface to person object
Dim objLDAP ' object to hold LDAP
domain name reponse
Dim aryTokens
Dim strPSURL
Dim strDomainDN
Set objPerson = CreateObject("CDO.Person")
strServerName = "MAILVOICE"
'LAB: get the domain name for the current user ("administrator" for this
lab)
Set objLDAP = GetObject("LDAP://rootdse")
strDomainName = objLDAP.Get("dnshostname")
strDomainName = Mid(strDomainName, InStr(strDomainName, ".") + 1)
strExchangeOrg = "organisation"
' change value to run on other exchange servers
strAdminGroup = "First Administrative Group"
strStorageGroup = "First Storage Group"
strStoreName = "Mailbox Store (" & strServerName & ")"
strEmailName = "mohlil"
strFirstName = "mohlil"
strLastName = "mohlil"
aryTokens = Split(strDomainName, ".", -1, 1)
strDomainDN = Join(aryTokens, ",dc=")
strDomainDN = "dc=" & strDomainDN & " "
'LAB: Create the user in Active Directory
objPerson.firstName = firstName
objPerson.lastName = lastName
objPerson.Fields("userPrincipalName") = lastName
objPerson.Fields("userAccountControl") = 512
objPerson.Fields("userPassword") = "password"
objPerson.Fields.Update
'objPerson.DataSource.SaveTo "LDAP://" & strServerName & "/CN=" &
strEmailName & ",CN=users," & strDomainDN & " "
Response.Write ("<p>")
Response.Write "LDAP://" & strServerName & "/CN=" & strEmailName
& ",CN=users," & strDomainDN
Response.Write ("</p>")
'LAB: create mailbox in specified location.
strPSURL = "LDAP://" & strServerName & "/CN=" & strStoreName
& ",CN=" & strStorageGroup & ",CN=InformationStore,CN=" & strServerName
& ",CN=Servers,CN=" & strAdminGroup & "," & "CN=Administrative Groups,CN="
+ strExchangeOrg & "," & "CN=Microsoft Exchange,CN=Services,"
& "CN=Configuration," & strDomainDN
Set objMailbox = objPerson.GetInterface("IMailboxStore")
objMailbox.CreateMailbox strPSURL
objPerson.DataSource.Save
Response.Write ("<br>")
Response.Write ("<P><B>MailBox created for:</B> " &
strEmailName & "</P>")
%></BODY></HTML>
Type error generate is:
(0x80040E21)
/affichedonne/creer.asp, line 48
and
Type d'erreur :
(0x80072030)
/affichedonne/creer.asp, line 59
please help me,
thanks
Message #2 by "Siegfried Weber" <sweber@c...> on Thu, 30 May 2002 18:24:06 +0200
|
|
I've been looking twice but couldn't locate the lines 48 & 60 hence I am
note sure where the error happens. So far looking over the code I cannot
see any obvious errors.
Since it appears that you are running this on a French Windows &
Exchange machine you might want to check if the names for the
administrative group are not different.
<Siegfried />
> -----Original Message-----
> From: mohbouraoui@y... [mailto:mohbouraoui@y...]
> Sent: Monday, May 27, 2002 7:11 PM
> To: ASP CDO
> Subject: [asp_cdo] probleme to create a mail box with exchange 2000
using
> script
>
> i'm trying to create new mailbox in exchange 2000. i can create a user
in
> the active directory using CDOEX, but i can't create mailbox and
generate
> me errors in line 48 and 60 (i use asp for creating new email) :
> the is the script when i use :
>
> <%@ Language=3DVBScript %>
>
> <%
> Dim strServerName ' the server name, for
> example "MyServer6"
> Dim strDomainName ' the server's domain, for
> example "MYDOMAIN3.microsoft.com"
> Dim strExchangeOrg ' the Exchange organization
> housing the mailbox store. For example "First Organization"
> Dim strAdminGroup ' the Exchange administrative
> group name, for example "First Administrative Group"
> Dim strStorageGroup ' the storage group for the
> mailbox store, for example "First Storage Group"
> Dim strStoreName ' the mailbox store name, for
> example "Mailbox Store (SERVERNAME)"
> Dim strEmailName ' emailname - the user's
email
> name, for example "jamessmith"
> Dim strFirstName ' the user's first name, for
> example "James"
> Dim strLastName ' the user's last name, for
> example "Smith"
> Dim objPerson ' object to hold CDO person
object
> Dim objMailbox ' object to hold IMailboxStore
> interface to person object
> Dim objLDAP ' object to hold LDAP
> domain name reponse
> Dim aryTokens
> Dim strPSURL
> Dim strDomainDN
>
> Set objPerson =3D CreateObject("CDO.Person")
> strServerName =3D "MAILVOICE"
>
> 'LAB: get the domain name for the current user ("administrator" for
this
> lab)
> Set objLDAP =3D GetObject("LDAP://rootdse")
> strDomainName =3D objLDAP.Get("dnshostname")
> strDomainName =3D Mid(strDomainName, InStr(strDomainName, ".") +
1)
>
> strExchangeOrg =3D "organisation"
> ' change value to run on other exchange servers
> strAdminGroup =3D "First Administrative Group"
> strStorageGroup =3D "First Storage Group"
> strStoreName =3D "Mailbox Store (" & strServerName & ")"
> strEmailName =3D "mohlil"
> strFirstName =3D "mohlil"
> strLastName =3D "mohlil"
>
> aryTokens =3D Split(strDomainName, ".", -1, 1)
> strDomainDN =3D Join(aryTokens, ",dc=3D")
> strDomainDN =3D "dc=3D" & strDomainDN & " "
>
> 'LAB: Create the user in Active Directory
> objPerson.firstName =3D firstName
> objPerson.lastName =3D lastName
> objPerson.Fields("userPrincipalName") =3D lastName
> objPerson.Fields("userAccountControl") =3D 512
> objPerson.Fields("userPassword") =3D "password"
> objPerson.Fields.Update
> 'objPerson.DataSource.SaveTo "LDAP://" & strServerName & "/CN=3D"
&
> strEmailName & ",CN=3Dusers," & strDomainDN & " "
>
>
>
> Response.Write ("<p>")
> Response.Write "LDAP://" & strServerName & "/CN=3D" & strEmailName
> & ",CN=3Dusers," & strDomainDN
> Response.Write ("</p>")
>
> 'LAB: create mailbox in specified location.
> strPSURL =3D "LDAP://" & strServerName & "/CN=3D" & strStoreName
> & ",CN=3D" & strStorageGroup & ",CN=3DInformationStore,CN=3D" &
strServerName
> & ",CN=3DServers,CN=3D" & strAdminGroup & "," & "CN=3DAdministrative
Groups,CN=3D"
> + strExchangeOrg & "," & "CN=3DMicrosoft Exchange,CN=3DServices,"
> & "CN=3DConfiguration," & strDomainDN
> Set objMailbox =3D objPerson.GetInterface("IMailboxStore")
> objMailbox.CreateMailbox strPSURL
> objPerson.DataSource.Save
>
> Response.Write ("<br>")
> Response.Write ("<P><B>MailBox created for:</B> " &
> strEmailName & "</P>")
> %></BODY></HTML>
>
>
>
> Type error generate is:
> (0x80040E21)
> /affichedonne/creer.asp, line 48
>
> and
> Type d'erreur :
> (0x80072030)
> /affichedonne/creer.asp, line 59
>
>
>
>
> please help me,
> thanks
|
|
 |