This cmdlet retrieves the list of opened MAPI sessions in the current powershell runspace.

Note: Parameters in orange are optional.
ProfileNameA optional string value that is the name of the MAPI profile to retrieve its active Session

A MAPI session is the root of most activity performed, excluding profile management operations.

As long as a MAPI session is open and valid, subsequent actions on stores, folders, items, recipients, etc. will work.  If the session is closed, dropped, or disconnected in some way, operations will fail.

PowerMapi stores a list of open sessions which can be listed by using this cmdlet.  Avoid opening too many sessions concurrently; there are memory constraints with MAPI and each active session consumes and reserves memory from the local host.

Use Remove-MapiSession to close and release memory for a MAPI session.  Failing to call Remove-MapiSession before closing PowerShell (or an application hosting System.Management.Automation) can cause memory leaks, especially if other connected object types (like Message, Folder, Attachment, etc.) are also in use.

PowerMapi has advanced object tracking mechanisms that will attempt to clean up stale and orphaned objects periodically, but using deterministic object lifetime is best.

MAPI sessions that only connect to profiles with PST files (no mailboxes) must still be 'closed', but also only have a file connection to the PST file.  Network drops should not affect such sessions unless the PST file has been opened from a remote file system.

Be aware that MAPI sessions to Exchange servers and Office365 can and do suffer from network interruptions, with Office365 more often dropping connections than on-premises Exchange servers.  Avoid long running operations (over many hours) with connected objects like Folders, Messages, and Address Books.  Batching operations, caching, and state management routines are important for any complicated scripts that involve MAPI and Exchange and/or Office365.