It seems that this issue has been thrashed around a number of time but
in my case, nothing seems to help. The code below actually worked fine
last week. Got back to it on Monday and it won't run. (Note the
variables prefaced wit h"g" are global and loaded wit hregistry values
elswhere)
I have checked the HomeMDBUrl 100 times and even pasted it from
ADSIEdit as suggested elsewhere. I also check the permissions on the
Exchange Administrator group and tried various user accounts. I also
cannot find and logging anywhere that might give me a hint as to what
is going on.
Private Sub CreateMailBox(ByRef User As OAC_UI_Objects.cUI_User)
' strHomeMDBUrl should look like this
Try
Dim strHomeMDBUrl As String = "CN=" & gMailBoxStore & ",CN=First
Storage Group," & _
"CN=InformationStore,CN=" & gExchangeServer & ",CN=Servers," & _
"CN=First Administrative Group,CN=Administrative Groups," & _
"CN=" & gExch_OU & ",CN=Microsoft
Exchange,CN=Services,CN=Configuration," & _
"DC=" & gFullDomain
'Create an ADSI User
Dim oPerson As ActiveDs.IADsUser = GetObject("LDAP://CN=" &
User.UserLogon & ",cn=Users,DC=" & gFullDomain)
Dim oMailbox As CDOEXM.IMailboxStore
Dim strUserName As String
strUserName = User.UserLogon
' Create a mailbox.
oMailbox = oPerson
oMailbox.CreateMailbox(strHomeMDBUrl)
' Save.
oPerson.SetInfo()
oPerson = GetObject("LDAP://CN=" & User.UserLogon &
",cn=Users,DC=" & gFullDomain)
'Update the User
User.ExchEmail = oPerson.EmailAddress
'Log the creation of the mailbox
EventLog.WriteEntry("AD", "An Exchange Mailbox was
successfully created for " & User.UserLogon & ". Their E-Mail address
is " & oPerson.EmailAddress, EventLogEntryType.Information)
' Clean up.
oPerson = Nothing
oMailbox = Nothing
Catch ex As Exception
EventLog.WriteEntry("AD", ex.ToString,
EventLogEntryType.Error)
End Try
End Sub
If anyone has any ideas, I'm all ears.
Jeff


Reply With Quote