Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_cdo thread: Error to creat a mail box with asp and CDOEX object


Message #1 by mohbouraoui@y... on Mon, 3 Jun 2002 09:23:51
hi, 

Thank you for the reponse, And I only wanted to say to you has what 
corresponds this error: 0x80040E21 in line 48 
(objPerson.DataSource.SaveTo "LDAP://" & strServerName & "/CN=" & 
strEmailName & ",CN=users," & strDomainDN & " " )?

If it is the problem of the security then where I give the administrator 
username and the password ?

Thank you a the next time!!

I send you of the new the script using:


<%
	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 & " " (this is line error 48 )


	    
	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 ((this is line error 59 ))

	Response.Write ("<br>")
	Response.Write ("<P><B>MailBox created for:</B>&nbsp;&nbsp;" & 
strEmailName & "</P>")
%></BODY></HTML>



 Type error generate is:
(0x80040E21)
/affichedonne/creer.asp, line 48

 and 
Type error  :
(0x80072030)
/affichedonne/creer.asp, line 59




please help me too, 
 thanks

  Return to Index