This documentation is archived and is not being maintained.

MAPIFolder.GetStorage Method

Gets a StorageItem object on the parent Folder to store data for an Outlook solution.

Namespace:  Microsoft.Office.Interop.Outlook
Assembly:  Microsoft.Office.Interop.Outlook (in Microsoft.Office.Interop.Outlook.dll)

[DispIdAttribute()]
StorageItem GetStorage(
	string StorageIdentifier,
	OlStorageIdentifierType StorageIdentifierType
)

Parameters

StorageIdentifier
Type: System.String

An identifier for the StorageItem object; depending on the identifier type, the value can represent an Entry ID, a message class, or a subject.

StorageIdentifierType
Type: Microsoft.Office.Interop.Outlook.OlStorageIdentifierType

Specifies the type of identifier for the StorageItem object.

Return Value

Type: Microsoft.Office.Interop.Outlook.StorageItem
A StorageItem object that is used to store data for a solution.

The GetStorage method obtains a StorageItem on a Folder object using the identifier specified by StorageIdentifier and has the identifier type specified by StorageIdentifierType. The StorageItem is a hidden item in the Folder, which roams with the account and is available online and offline.

If you specify the EntryID for the StorageItem by using the olIdentifyByEntryID value for StorageIdentifierType, then the GetStorage method will return the StorageItem with the specified EntryID. If no StorageItem can be found using that EntryID or if the StorageItem does not exist, then the GetStorage method will raise an error.

If you specify the message class for the StorageItem by using the olIdentifyByMessageClass value for StorageIdentifierType, then the GetStorage method will return the StorageItem with the specified message class. If there are multiple items with the same message class, then the GetStorage method returns the item with the most recent PidTagLastModificationTime. If no StorageItem exists with the specified message class, then the GetStorage method creates a new StorageItem with the message class specified by StorageIdentifier.

If you specify the Subject of the StorageItem, then the GetStorage method will return the StorageItem with the Subject specified in the GetStorage call. If there are multiple items with the same Subject, then the GetStorage method will return the item with the most recent PidTagLastModificationTime. If no StorageItem exists with the specified Subject, then the GetStorage method will create a new StorageItem with the Subject specified by StorageIdentifier.

GetStorage returns an error if the store type of the folder is not supported. The following stores return an error when GetStorage is called:

  • Hotmail store

  • Internet Message Access Protocol (IMAP) stores

  • Delegate stores

  • Public folder stores

The Size of a StorageItem that is newly created is zero (0) until you make an explicit call on the Save method of the item.

For more information on storing data for a solution, see Storing Data for Solutions.

Show: