OL2000: RemoveStore Method Available to Close Personal Folders

ID: Q238935


The information in this article applies to:
  • Microsoft Outlook 2000


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.


REFERENCES

For additional information about available resources and answers to commonly asked questions about Microsoft Outlook 2000 solutions, please see the following article in the Microsoft Knowledge Base:

Q146636 OL2000: Questions About Custom Forms and Outlook Solutions

Additional query words: OL2K OutSol OutSol2000 vbscript

Keywords : OffVBS
Version : WINDOWS:2000
Platform : WINDOWS
Issue type : kbhowto


Last Reviewed: August 12, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.