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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

deleteMailbox isn't doing anything in Exchange 2003 1

Status
Not open for further replies.

frumpus

Programmer
Aug 1, 2005
113
US
the deleteMailbox command worked fine with Exchange 2000 in the code below. I haven't changed the script at all but doesn't work with Exchange 2003 and generates NO error. it behaves as if deletes the mailbox just fine but the mailboxes never actually go away. Is there a new method for 2003?

Code:
Set objPerson = CreateObject("CDO.Person")
objPerson.DataSource.Open adsPath

On Error Resume Next 

Set iMbx = objPerson.Getinterface("IMailboxStore")

If Err.Number = 0 Then
   iMbx.DeleteMailbox
   If Err.Number = 0 Then
      logfile.WriteLine("Mailbox Deleted")
   Else
      logfile.WriteLine("Unable to delete mailbox")
      logfile.WriteLine(Err.Description & vbCrLf & Err.Source & vbCrLf)
      Err.Clear
   End If
Else
   logfile.WriteLine("Mailbox not found")
   logfile.WriteLine(Err.Description & vbCrLf & Err.Source & vbCrLf)
   Err.Clear
End If

On Error Goto 0

Set iMbx = Nothing
Set objPerson = Nothing

I'm pretty sure it isn't a permissions problem. It is being run by the network administrator and when run under another account with insufficient privileges it will generate errors.
 
Add a line to save datasource if you are using a reference I am using.
[tt]
iMbx.DeleteMailbox
If Err.Number = 0 Then
logfile.WriteLine("Mailbox Deleted")
[blue]objPerson.DataSource.save[/blue]
Else
logfile.WriteLine("Unable to delete mailbox")
logfile.WriteLine(Err.Description & vbCrLf & Err.Source & vbCrLf)
Err.Clear
End If
[/tt]
 
That did the trick for deleting the mailboxes but the users are still showing up in the global address list :(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top