This documentation is archived and is not being maintained.

NameSpace.AddStore Method

Office 2007
Adds a Personal Folders (.pst) file to the current profile.

Syntax

expression.AddStore(Store)

expression   A variable that represents a NameSpace object.

Parameters

NameRequired/OptionalData TypeDescription
StoreRequiredVariantThe path of the .pst file to be added to the profile. If the .pst file does not exist, Microsoft Outlook creates it.

Remarks

Use the RemoveStore method to remove a .pst that is already added to a profile.

Example

This Microsoft Visual Basic/Visual Basic for Applications (VBA) example adds a new Personal Folders (.pst) file to the user’s profile.

Visual Basic for Applications
Sub CreatePST()
    Dim myNameSpace As Outlook.NameSpace

    Set myNameSpace = Application.GetNamespace("MAPI")
    myNameSpace.AddStore "c:\" & myNameSpace.CurrentUser & "\.pst"
End Sub



Show: