Partager via


StoreID Property

Returns a String indicating the store ID for the folder. Read-only.

expression**.StoreID**

*expression    * Required. An expression that returns a MAPIFolder object.

Example

This Visual Basic for Applications (VBA) example obtains the EntryID and StoreID for the default Tasks folder and then calls the GetFolderFromID method using these values to obtain the same folder. The folder is then displayed.

Sub GetWithID()
 Dim myOlApp As Outlook.Application
 Dim myFolder As Outlook.MAPIFolder
 Dim myEntryID As String
 Dim myStoreID As String
 Dim myNewFolder As Outlook.MAPIFolder
 Set myOlApp = CreateObject("Outlook.Application")
 Set myFolder = myOlApp.Session.GetDefaultFolder(olFolderTasks)
 myEntryID = myFolder.EntryID
 myStoreID = myFolder.StoreID
 Set myNewFolder = myOlApp.Session.GetFolderFromID(myEntryID, myStoreID)
 myNewFolder.Display
End Sub

If you use Microsoft Visual Basic Scripting Edition (VBScript) in a Microsoft Outlook form, you do not create the Application object, and you cannot use named constants. This example shows how to use the StoreID property using VBScript code.

Sub CommandButton1_Click()
 Set myNameSpace = Application.GetNameSpace("MAPI")
 Set myFolder = myNameSpace.GetDefaultFolder(13)
 myEntryID = myFolder.EntryID
 myStoreID = myFolder.StoreID
 Set myNewFolder = myNameSpace.GetFolderFromID(myEntryID, myStoreID)
 myNewFolder.Display
End Sub

Applies to | MAPIFolder Object

See Also | GetFolderFromID Method