We help IT Professionals succeed at work.
Get Started

Purge a Mailbox from Exchange2003 programatically using C# or VB.net

bobby010606
bobby010606 asked
on
839 Views
Last Modified: 2013-11-26
HI experts

How do purge a mailbox of a user (not disabe) from Exchange server 2003 programatically using C# or VB.net

I am able to disable the Exchange mailbox of a user using the code below ..I added the referance CDOEXM to code

                        Try
                                UserMailbox = ObjExchange.NativeObject
                                UserMailbox.DeleteMailbox()
                                ObjExchange.CommitChanges()
                                MbxDel = "Deleted"
                            Catch ex As Exception
                                MbxDel = "Error"
                                MbxDelErr = ex.Message
                            End Try

After doing lot of google ...i came to know that Purge() will delete the user mailbox perminently from Exchange Server 2003
 so i tried the below  code ...its not working

                        Try
                                UserMailbox = ObjExchange.NativeObject
                                UserMailbox.Purge() 'Delete mailBox
                                ObjExchange.CommitChanges()
                                MbxDel = "Purged"
                            Catch ex As Exception
                                MbxDel = "Error"
                                MbxDelErr = ex.Message
                            End Try

Its not doing any thing...can any one plz help me ....
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE