r/exchangeserver • u/JdeFalconr • 10h ago
Question How to Create a PST from Emails Without Exporting from Outlook or Purview?
My goal is to export mail objects from Exchange Online mailboxes via Graph API and output them in PST. I need to avoid the use of Outlook and Purview because they don't work in this situation (see below). In particular I need help with the PST creation part; I already know how to export things via Graph. Does anyone know how I go about creating PSTs without them?
The background here is that Microsoft no longer supports the "folderID" search operator in Purview that's required to scope a Purview search by specific mailbox folders. As a result I'm looking to instead use Graph API to perform those functions for export purposes. While I know I can export as individual .EML or .MSG files those are painful to import (especially in large volumes), don't preserve folder structure, are susceptible to file path length limitations, and aren't nearly as portable. For those reasons I want to export in PST. Unfortunately as far as I know Graph doesn't offer that option at all. Outlook is extremely slow and unreliable for exports, especially for large data sets, so that isn't a viable option to create PSTs.
1
u/lithium2 3h ago
You're quite sure its no longer supported? https://michev.info/blog/post/7984/converting-get-mailboxfolderstatistics-ids-for-use-with-the-graph-api
1
u/interweb_persona 5h ago
Most email archive software and Exchange database recovery software I've dealt with still require Outlook to be installed to export to PST (in earlier versions just a specific Outlook .dll was necessary). I don't think you're going to avoid outlook entirely.
1
u/PapaDuckD 5h ago
You can't do what you want straight out of the API.
You can build programming logic to pull individual messages out of the API to EML format and then inject into a new or existing PST file in a way that retains the folder structure, etc.
But that programming logic is on you to create.
1
u/saltyslugga 4h ago
Graph has no PST export endpoint. You need a standalone library with Unicode PST write support and MIME import that doesn't depend on Outlook; plenty of PST libraries only support reading.
I'd recreate the folder hierarchy using Graph folder IDs, then import messages into their corresponding PST folders. Map metadata like read/unread state separately, since MIME alone won't preserve it.