StorageItem Interface

A message object in MAPI that is always saved as a hidden item in the parent folder and stores private data for Outlook solutions.

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

public interface StorageItem : _StorageItem

This is a .NET interface derived from a COM coclass that is required by managed code for interoperability with the corresponding COM object. Use this derived interface to access all method, property, and event members of the COM object. However, if a method or event you want to use shares the same name under the same COM object, cast to the corresponding primary interface to call the method, and cast to the latest events interface to connect to the event. Refer to this topic for information about the COM object. For information about the method and property members of the COM object, see _StorageItem.

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 MAPIFolder.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 and DisplayFormat arguments of the UserProperties.Add method will be ignored.

  • 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.