Storing Outlook Items

This topic describes how Outlook items are stored in folders and stores based on an account in the current profile.

The Outlook object model provides the following objects to store Outlook items:

  • The Folder object, which represents a container for other Folder objects and Outlook items.

    Note The Folder object has replaced the MAPIFolder object that existed in Microsoft Office Outlook 2003 and earlier versions of Outlook. New solutions should only use Folder.

  • The Folders collection, which represents all the Folder objects at one level of the folder tree in a store. The Folders collection can also represent a collection of search folders.

    Note Although a search folder is represented programmatically by a Folder object, not all events, methods, and properties of Folder apply to search folders.

  • The Store object, which represents a file on the local computer or a network drive that stores email messages and other items. If you use an Exchange server, you can have a store on the server, in an Exchange Public folder, or on a local computer in a Personal Folders File (.pst) or Offline Folder File (.ost). For a POP3, IMAP, and HTTP email server, a store is a .pst file.

    You can add a store to the current profile using NameSpace.AddStore and NameSpace.AddStoreEx, and remove an existing store from the current profile using NameSpace.RemoveStore.

  • The Stores collection, which represents all the stores in the current Outlook profile. A profile defines one or more email accounts, and each email account is associated with a server of a specific type. The type of server determines the type of the store and how email and other items are delivered and stored. For example, an Exchange server stores email and other items in either a .pst file or a .ost file on the local computer or a mapped network drive, and an HTTP server (such as Hotmail) stores items in a .pst file on the local computer.

The Store and Stores objects support the following:

  • Enumerating folders in a store using Store.GetRootFolder and then Folder.Folders.

  • Enumerating search folders in a store using Store.GetSearchFolders.

    Note Since a store does not necessarily support search folders, in general, you should trap for returned errors when using Store.GetSearchFolders to obtain any search folders on a store.

  • Better performance with enumerating folders. Because getting the root folder or search folders in a store requires the store to be open and opening a store imposes an overhead on performance, you can check the Store.IsOpen property before you decide to pursue the operation.

  • Locating a local store (.pst or .ost) for an Exchange server, or a store (.pst) for a POP3, IMAP, or HTTP email server, using the Store.FilePath property.

  • Discovery of the Exchange store type and differentiation among different Exchange store types using the Store.ExchangeStoreType property.

  • Additional information for an Exchange server through the Store.IsCachedExchange and Store.IsDataFileStore properties.

  • The PropertyAccessor object through the Store.PropertyAccessor property, allowing access to store properties that are not exposed as explicit built-in properties in the Outlook object model.

Support and feedback

Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.