Greetings and salutations. I am working on a vb.net windows application that will search AD and find all disabled accounts who's mailbox is on a specified server. Application shows a list of all exchange servers and selection populates the LDAP search parameters. All this is working fine, it is just when it comes to actually moving the mailbox it fails with some weird results.
The mailboxes I want to move belongs to accounts that are disabled, and some will have the "msExchHideFromAddressLists" set to True...
So, I have come up with this function, and I pass the user's distinguishedname to it:
What happens is that it seems to connect ok to the object, but generates a catastrophic failure.
The weird thing is, that if I manually enter my own distinguishedname (or any other live account, it works fine.
Does anyone have any ideas, as I am pretty lost...
The mailboxes I want to move belongs to accounts that are disabled, and some will have the "msExchHideFromAddressLists" set to True...
So, I have come up with this function, and I pass the user's distinguishedname to it:
VB.NET:
Function Movemailbox(ByVal distinguishedname As String)
Try
Dim ldapstring As String
ldapstring = "LDAP://" & distinguishedname
Dim objuser As DirectoryEntry = New DirectoryEntry(ldapstring)
Dim objmailbox As CDOEXM.IMailboxStore = objuser.NativeObject
objmailbox.MoveMailbox("LDAP://CN=<mailstore>,CN=<storagegroup>,CN=InformationStore,CN=<server>,CN=Servers,CN=<admin group>,CN=Administrative Groups,CN=<organisation>,CN=Microsoft Exchange,CN=Services,CN=Configuration,DC=<domain>,DC=com")
objuser.CommitChanges()
Catch ex As System.Exception
MessageBox.Show("Error: " & ex.ToString)
End Try
End Function
What happens is that it seems to connect ok to the object, but generates a catastrophic failure.
System.Runtime.InterOpServices.COMException (0x8000FFFF): Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED)) at CDOEXM.IMailBoxStore,MoveMailbox(String HomeMDBURL)
The weird thing is, that if I manually enter my own distinguishedname (or any other live account, it works fine.
Does anyone have any ideas, as I am pretty lost...
Last edited: