Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

CreateMailbox() won't work

Status
Not open for further replies.

Jerrycurl

Programmer
Aug 4, 1999
85
US
I'm writing code to add a user to the Active Directory and create an Exchange mailbox for that user. Here's what I have:

Try
Dim de As New DirectoryEntry("LDAP://server.domain.net/cn=users,dc=domain,dc=net", "administrator", "password")

Dim UsrName As String = txtLogon.Text
Dim NewUser As System.DirectoryServices.DirectoryEntry
NewUser = de.Children.Add("CN=" & UsrName, "user")
Dim n As ActiveDs.IADsUser = NewUser.NativeObject
With NewUser
.Properties("sAMAccountName").Value = UsrName
.CommitChanges()

With n '.NativeObject

.AccountDisabled = False
.FirstName = txtFirstName.Text
.LastName = txtLastName.Text
.FullName = txtFirstName.Text & " " & txtLastName.Text

.SetInfo()
.SetPassword(txtPassword.Text)
End With
NewUser.CommitChanges()
End With

Dim objmailbox As CDOEXM.IMailboxStore = n
Dim strUrL As String

strUrL = "LDAP://server.domain.net/CN=Mailbox Store (SERVER),CN=First Storage Group,CN=InformationStore,CN=SERVER,CN=Servers,CN=First Administrative Group,CN=Administrative Groups,CN=PHRACK,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=domain,DC=net"

objmailbox.CreateMailbox(strUrL)

Catch ex As Exception
Console.WriteLine(ex.Message)
Console.ReadLine()
MsgBox(ex.ToString)
End Try


The user gets added to Active Directory fine, but at objmailbox.CreateMailbox(strURL), I get the error "The authentication mechanism is unknown." The strURL is cut and pasted directly out of ADSIEdit, so I know there are no typos there. This is driving me nuts. Has anyone run into this before, or does anyone have any ideas? Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top