|Session||A Mapi.NET.Session object from which to retrieve the requested store object.|
|GetPrimaryStore||A SwitchParamter which, when present, retrieves the primary (default) message store from Session.|
|GetPublicFolderStore||A SwitchParameter which, when present, retrieves the Public Folders store from Session, if one exists. See remarks.|
|StoreID||A System.GUID value that uniquely identifies a store in Session to retrieve.|
|StoreName||A text string that is the name of a message store in Session to retrieve.|
A MAPI "store" is a top level object containing one or more folder trees and contents.
An Exchange mailbox, Exchange Public Folders, and PST files are all examples of message stores. There can also be 3rd party message stores for customized purposes.
Message stores available in a given MAPI session are determined by details in the related MAPI profile. Each Profile Service configured can have one or more message store Providers, and each one adds to the list of available message stores.
Note that in Microsoft Exchange, a MAPI profile when first configured, may not have a Public Folder store provider configured in the profile. Typically, if the Exchange environment has Public Folders, and the authenticated user has proper permissions, Outlook will add the Public Folder provider to the profile at first logon, after doing some discovery in the environment.
It is possible that a particular Exchange environment does not have any Public Folder stores; using the GetPublicFolderStore parameter would fail in such cases.
Note that there is not a direct relationship between the terms "message store" and "database". A message store is simply a hierarchical "store" of data of which its physical storage or platform is unrelated. For example, with Exchange 2013 the Public Folder store is managed in the back end by one or more special Public Folder "mailboxes", and not a database. A database in Exchange is simply a container of one or more message stores.
The GetPrimaryStore parameter, as its name implies, retrieves the primary message store. Typically the first profile service that provides a message store provider becomes the primary. Starting with Outlook 2010, Microsoft allowed for the ability to create profiles that connect to multiple Exchange environments simultaneously. For such profiles, only one of the configured mailboxes in the profile will be the Primary. However, it can occur that the primary can be removed from the profile and none of the other configured mailboxes are promoted to be the primary, resulting in no primary mailboxes.
When this cmdlet is called with only the Session parameter, it is the same as using the GetPrimaryStore switch.
Each message store in a MAPI profile has a unique GUID associated with it. This value can be used to quickly open the same store between sessions. However, be aware that this value is a randomly generated value that is created when the store is first configured in the profile. If the store details are removed from the profile and a new entry is configured for the same store, the associated store ID changes. Also, 2 MAPI profiles both configured to the same message store will also have different store IDs.
For Exchange mailboxes only, if the EntryID of the mailbox store is saved, the value can be used with Open-MapiMailbox in an existing session. See detail of that cmdlet for usage and remarks.
The StoreName parameter can be used to select a message store by its display name. Note that this value can be duplicated between stores and this cmdlet will return the first store that matches the name provided.