Export mailbox to pst

Home Forums PowerMapi Scripts Export mailbox to pst

This topic contains 0 replies, has 1 voice, and was last updated by  powerm15_wp 3 years, 12 months ago.

Viewing 1 post (of 1 total)
  • Author
  • #513


    A common exercise for any script writer that works with email is to export data from a mailbox.

    PowerMapi makes this work easy and such can be done from any source where mapi is used.

    This example will take the common use-case of exporting data from a mailbox in Microsoft Exchange to a PST file.

    $sess = New-MapiSession outlook-main
    $sourceStore = get-mapistore $sess -GetPrimaryStore
    $sourceRootFolder = Get-MapiFolder $sourceStore -CommonFolder IPMSubtree
    $pstStore = Open-MapiPST -PstFilePath c:\temp\out.pst -Session $sess -CreateNew
    $pstRootFolder = Get-MapiFolder $pstStore -CommonFolder IPMSubtree
    Copy-MapiFolder -SourceFolder $sourceRootFolder -DestinationFolder $pstRootFolder -CopySubfolders

    The above should be self-explanatory. Additional script work could be done to track how much data is being copied into the target (to avoid exceeding the PST file size limit, for example) or to exclude folders or items. There are cmdlets to search and filter items that can make the above more capable.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.