Open-MapiExchangeMailbox

Description

This cmdlet opens an Exchange mailbox using a provided MAPI session.

Syntax
Note: Parameters in orange are optional.
Open-MapiExchangeMailbox
-SessionMapiObject<Mapi.NET.Session>
-MailboxIdentifierString
-OpenFlagsMapi.NET.Flags.PR_PROFILE_OPEN_FLAGS[]
Open-MapiExchangeMailbox
-SessionMapiObject<Mapi.NET.Session>
-MailboxUserSystem.DirectoryServices.DirectoryEntry
-OpenFlagsMapi.NET.Flags.PR_PROFILE_OPEN_FLAGS[]
Parameters
SessionAn open Mapi.NET.Session object from which to open the mailbox. See remarks.
MailboxIdentifierA text string that is an identifier for the mailbox. See remarks.
MailboxUserA System.DirectoryServices.DirectoryEntry object representing a user from Active Directory that has a mailbox.
OpenFlagsOne or more of the flag values from Mapi.NET.Flags.PR_OPEN_PROFILE_FLAGS.
Remarks

This cmdlet is used to open additional Exchange mailboxes from within an existing MAPI session.

The session must from a profile that has an existing Exchange mailbox configured.  This cmdlet will only open mailboxes in the same Exchange organization as the primary mailbox configured in the session's profile.

It is much more efficient to open multiple mailboxes from a single MAPI session than to create multiple profiles.  The opened mailboxes are not added to the session's profile and are valid until the mailbox is disposed or until the session is logged off.  This action is very similar to how Outlook allows for opening secondary mailboxes in a profile.

In order to open a mailbox, the user account used to authenticate to the Session must have appropriate permission.  Specifically, a user must either have Full Access permission to a specific mailbox, or must have the Receive-As permission to the mailbox, mailbox database, administrative group, or Exchange organization object under which the requested mailbox resides.

In order to avoid issues with user delegate permissions on folders, it is recommended to open additional mailboxes using the OpenFlags value of 'UseAdminPrivilege'.  This flag requests to open the mailbox using "system privileges" which bypass rights set by individual users.  The user that authenticated the Session must have the 'Administer Information Store' right on the mailbox database of the mailbox being requested in order to use the "system privilege" feature.  System Privileges on an mailbox database allow a user to access and operate on mailboxes in that database in the same way that the various Exchange system tools and services operate.

The MailboxUser parameter allows for passing an Active Directory user account to the cmdlet.  Provided that the user account has a mailbox, the cmdlet will do the work to gather the proper data necessary to open the mailbox.  However, permissions are still required as describe in the preceding paragraphs.

The MailboxIdentifier parameter is a multi-use string for selecting the specific mailbox to open.  SMTP and X500 addresses can be used or string version of a mailbox EntryID value.