Microsoft KB Archive/238935

= OL2000: RemoveStore Method Available to Close Personal Folders =

Article ID: 238935

Article Last Modified on 10/9/2003

-

APPLIES TO


 * Microsoft Outlook 2000 Standard Edition

-



This article was previously published under Q238935



SUMMARY
Although the RemoveStore method is not documented in the Microsoft Outlook Visual Basic Reference (Vbaoutl9.chm), it does exist in the Outlook object model and can be used to close a Personal Folders file (.pst) that is loaded in your profile.



MORE INFORMATION
The RemoveStore method was added late in the development process, after the object model documentation was complete. However, it is mentioned on page 483 of the Building Applications with Microsoft Outlook 2000 book by Microsoft Press.

NOTE: The book incorrectly makes reference to a RemovePST method. This should be RemoveStore, as the code sample in the book illustrates.

The RemoveStore method is available from the NameSpace object and requires one argument, which is the folder object representing the Personal Folders file (.pst) you want to remove.

RemoveStore Method
Syntax

object.RemoveStore Store

object: Required. An expression that returns a NameSpace object.

Store: Required Object. The Outlook MAPIFolder object to be removed from the profile.

RemoveStore Method Example
This Microsoft Visual Basic/Visual Basic for Applications example removes a Personal Folders (.pst) file from the user's profile. In this case, the name of the personal folder is Personal Folders.

Dim myOlApp As New Outlook.Application Dim myNS As Outlook.NameSpace Set myNS = myOlApp.GetNamespace("MAPI") Set myFolder = myNS.Folders("Personal Folders") myNS.RemoveStore myFolder If you use VBScript, you do not create the Application object. This example shows how to perform the same task using VBScript.

Set myNS = Application.GetNamespace("MAPI") Set myFolder = myNS.Folders("Personal Folders") myNS.RemoveStore myFolder

NOTE: If you use the RemoveStore method to close a Personal Folders file, a file lock is still kept on the .pst file by the MAPI spooler. Therefore, you cannot programmatically move or delete the Personal Folders file without completely exiting Outlook and making sure the MAPI spooler is shut down.

