StorageItem Object
Outlook Developer Reference |
A message object in MAPI that is always saved as a hidden item in the parent folder and stores private data for Outlook solutions.
Version Information
Version Added: Outlook 2007
Remarks
A StorageItem object is stored at the folder level, allowing it to roam with the account and be available online or offline.
The Outlook object model does not provide any collection object for StorageItem objects. However, you can use Folder.GetTable to obtain a Table with all the hidden items in a Folder, when you specify the
TableContents
parameter as olHiddenItems. If keeping your data private is of a high concern, you should encrypt the data before storing it.
Once you have obtained a StorageItem object, you can do the following to store solution data:
- Add attachments to the item for storage.
- Use explicit built-in properties of the item such as Body to store custom data.
- Add custom properties to the item using UserProperties.Add method. Note that in this case, the optional AddToFolderFields
- Use the PropertyAccessor object to get or set custom properties.
The default message class for a new StorageItem is IPM.Storage. If the StorageItem existed as a hidden message in a version of Outlook prior to Microsoft Office Outlook 2007, the message class will remain unchanged. In order to prevent modification of the message class, StorageItem does not expose an explicit MessageClass property.
For more information on storing solution data using the StorageItem object, see Storing Data for Solutions.
Example
The following code sample in Visual Basic for Applications shows how to use the StorageItem object to store private solution data. It saves the data in a custom property of a StorageItem object in the Inbox folder. The following describes the steps.
- The code sample calls Folder.GetStorage to obtain an existing StorageItem object that has the subject "My Private Storage" in the Inbox. If no StorageItem with that subject already exists, GetStorage creates a StorageItem object with that subject.
- If the StorageItem is newly created, the code sample creates a custom property "Order Number" for the object. Note that "Order Number" is a property of a hidden item in the Inbox.
- The code sample then assigns a value to "Order Number" and saves the StorageItem object.
Visual Basic for Applications |
---|
|
See Also