Hi I have a problem with the code stated below. The problem is that when trying to call the createMailbox function I get an 'one or more arguments are invalid' error. I really think I have tried everything but I just can't debug/correct the error. Hope someone are able to help me out here, thanks.
/Sebastian
<%
'First of all, get authenticated on this server.
dim IADsPath
Dim pwd
Dim uid
Dim flags
IADsPath = "LDAP://Morgul.test.dk/OU=internal, DC=test,DC=dk"
uid = "TEST\Administrator"
pwd = "********"
flags = 0
dim IADsNameSpace
set IADsNameSpace = GetObject("LDAP:")
Dim oIADsObject
set oIADsObject = IADsNameSpace.OpenDSObject( IADsPath, uid, pwd, flags )
If err.number = 0 Then
Response.Write("Login Was Successful: " & uid)
Else
Response.Write("Login Failed: " & uid)
Response.Write(err.number)
Response.Write(err.description)
End If
' Here I am going to create a user account
Dim userObj
set userObj = oIADsObject.Create("User", "cn=tester")
userObj.Put "samAccountName","tester"
userObj.Put "userPrincipalName", "Mr. Test"
userObj.Put "givenName", "Testperson"
userObj.Put "sn", "test"
userObj.Put "DisplayName", "
[email protected]"
userObj.Put "mail", "
[email protected]"
userObj.SetInfo
userObj.changePassword "", "test"
userObj.AccountDisabled = False
userObj.SetInfo
' Now to create a mailbox
Dim mailboxObj
set mailboxObj = userObj
mailboxObj.CreateMailbox "LDAP://Morgul.test.dk/CN=Mailbox Store (Morgul), CN=First Storage Group, CN=InformationStore, CN=Morgul, CN=Servers, CN=First Administrative Group, CN=Administrative Groups, CN=Morgul Online,CN=Microsoft Exchange, CN=Services, CN=Configuration, DC=test, DC=dk"
Dim contactObj
set contactObj = oIADsObject.Create("contact", "cn=testing")
contactObj.Put "givenName", "testing"
contactObj.Put "sn", "testing"
'contactObj.Email = "
[email protected]"
contactObj.SetInfo
contactObj.MailEnable "smtp:
[email protected]"
contactObj.SetInfo
'setting the forwarding mail
userObj.ForwardTo = "LDAP://morgul.test.dk/CN=testing, OU=internal, DC=test,DC=dk"
userObj.SetInfo
set userObj = Nothing
set contactObj = Nothing
set mailboxObj = Nothing
set IADsNameSpace = Nothing
%>