MAPIFolder.GetStorage(String, OlStorageIdentifierType) Method

Definition

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

public:
 Microsoft::Office::Interop::Outlook::StorageItem ^ GetStorage(System::String ^ StorageIdentifier, Microsoft::Office::Interop::Outlook::OlStorageIdentifierType StorageIdentifierType);
public Microsoft.Office.Interop.Outlook.StorageItem GetStorage (string StorageIdentifier, Microsoft.Office.Interop.Outlook.OlStorageIdentifierType StorageIdentifierType);
Public Function GetStorage (StorageIdentifier As String, StorageIdentifierType As OlStorageIdentifierType) As StorageItem

Parameters

StorageIdentifier
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
OlStorageIdentifierType

Specifies the type of identifier for the StorageItem object.

Returns

A StorageItem object that is used to store data for a solution.

Remarks

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:

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

Applies to