CreatMailBox throws "There is no such object on the server"
Exchange Server Forum Index Exchange Server
Discussion forums for Microsoft Exchange Server users.
Microsoft Outlook
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web ExchangeServerHelp.com
CreatMailBox throws "There is no such object on the server"

 
Post new topic   Reply to topic    Exchange Server Forum Index -> Development
Author Message
JeffW
Guest





Posted: Fri Dec 02, 2005 1:58 am    Post subject: CreatMailBox throws "There is no such object on the server" Reply with quote

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

Back to top
JeffW
Guest





Posted: Fri Dec 02, 2005 1:58 am    Post subject: Re: CreatMailBox throws "There is no such object on the serv Reply with quote

OK, I fixed it. This is a combination of "Duh!!" and stupid coding in
the library. The problem was that in the HomeMDBUrl I didn't have a
space between the "Mailbox Store" and the "(" for the server name.
Added the space and all's right with the world until.......I changed
the actual Mailbox Store from the default "Mailbox Store" to a
different store that my client wants to use for Students (It's a
college). If you use the default "MailBox Store" you MUST include the
server name enclosed in parens "(Servername )" and there MUST be a
space between "...Store" and "(". If you specify a different MailBox
Store like "Student_MailboxStore" you MUST NOT include the server name
at all and no Parens "( )".

This is the kind of frustration that I think almost everyone runs into
with ADSI coding. There really needs to be better error handling as
well as better coding consistancy in the libraries. This make it look
like CDOEXM was coded by a committee in different parts of the
world...Ummmm....out-sourcing perhaps?

Always learning
Jeff
Back to top
JeffW
Guest





Posted: Fri Dec 02, 2005 1:58 am    Post subject: Re: CreatMailBox throws "There is no such object on the serv Reply with quote

OK, I fixed it. This is a combination of "Duh!!" and stupid coding in
the library. The problem was that in the HomeMDBUrl I didn't have a
space between the "Mailbox Store" and the "(" for the server name.
Added the space and all's right with the world until.......I changed
the actual Mailbox Store from the default "Mailbox Store" to a
different store that my client wants to use for Students (It's a
college). If you use the default "MailBox Store" you MUST include the
server name enclosed in parens "(Servername )" and there MUST be a
space between "...Store" and "(". If you specify a different MailBox
Store like "Student_MailboxStore" you MUST NOT include the server name
at all and no Parens "( )".

This is the kind of frustration that I think almost everyone runs into
with ADSI coding. There really needs to be better error handling as
well as better coding consistancy in the libraries. This make it look
like CDOEXM was coded by a committee in different parts of the
world...Ummmm....out-sourcing perhaps?

Always learning
Jeff

Back to top
 
Post new topic   Reply to topic    Exchange Server Forum Index -> Development All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Windows Server Dedicated Servers
New Topics Powered by phpBB