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

Accessing Root Level to delete folder

Status
Not open for further replies.

NetMgrMke

Technical User
May 3, 2005
6
US
I am trying to access the root level to the delete the Folder Mike but it says the object is not found. How do I access the root level to delete the Mike folder?

The folder is not located on the inbox tree but rather the root of my mailbox.

Any help appreciated.

Thanks
Mike


Sub CommandButton1_Click()
Set oNameSpace = Application.GetNamespace("MAPI")
Set oFolder = oNameSpace.GetDefaultFolder(10)
Set oOldFolder = oFolder.Folders("Mike")


'Prompt the user for confirmation
Dim strPrompt
strPrompt = "Are you sure you want to delete the folder?"
If MsgBox(strPrompt, vbYesNo + vbQuestion) = vbYes Then
oOldFolder.Delete
MsgBox ("Folder deleted")
End If
End Sub

 
You may try this:
Set oFolder = oNameSpace.GetDefaultFolder(6).Parent
Set oOldFolder = oFolder.Folders("Mike")


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top