
Can't get Remove method to work
Never mind. I found the RemoveStore method and have figured out how to use
it from the XP documentation. In case you were wondering:
Sub RemovePST()
Dim objName As NameSpace
Dim objFolder As MAPIFolder
Set objName = Application.GetNamespace("MAPI")
Set objFolder = objName.Folders.Item("Personal Folders")
objName.RemoveStore objFolder
End Sub
The key is to point the method to the folder object representing the root of
your target Store.
Paul
Quote:
> I am using AddStore to add a PST to my namespace. When I want to remove
it,
> I get an error. Here is my code:
> Set myNameSpace = Application.GetNameSpace("MAPI")
> myNameSpace.AddStore("c:\test.pst")
> ' The following loads my new PST root folder into the variable myFolder
so
> I can display some things about it...just for info...will be cut when the
> program goes live
> Set myFolder = myNameSpace.Folders.GetLast
> msgbox myFolder.name & vbcrlf & vbcrlf & myFolder.storeid & vbcrlf &
vbcrlf
> & myFolder.entryID & vbcrlf & vbcrlf & myNameSpace.Folders.count
> ' Here I just loop through to see what I have under my namespace
> for intLoop = 1 to myNameSpace.Folders.Count
> msgbox "I am Folder " & intLoop & ". My name is: " &
> myNameSpace.Folders(intLoop).Name
> next
> myNameSpace.Folders.Remove(myNameSpace.Folders.Count)
> I have tried replacing the index w/an actual number. I have tried it w/
and
> without the parenthesis. I have tried receiving a return value to a
> variable. Nothing works. In the documentation, the Remove variable applies
> to Folder Collections. Is there something here I am missing?
> --
> Regards,
> Paul
> <><><><><><><><><><><><><><><><><><><><>
> Source Imaging, LLC.
> Paul Engel, President
> Certified Document Imaging Architech (CDIA)
> Summation Certified Trainer (SCT)
> Voice: 859-255-5222
> Fax: 859-514-1705
> www.source-imaging.com
> <><><><><><><><><><><><><><><><><><><><>