0

I do not think there is an EASY, right click -> export to PST for a mailbox, if you know of one, please let me know.

Since I can't find an easy way, I am going to attempt the code route.

I am looking to write some code to export an O365 mailbox to a .pst file. This is a local backup for when we want to keep the contents of an O365 mailbox after removing licenses.

After removing the O365 Licenses, the mailbox will stay for 30 days and then it is deleted.

I saw a post with a description about using Redemption which I have licensed, but there really is no detail on the process.

Microsoft Graph API to extract a .pst

I have access to the mailbox via EWS and would like to iterate through folders and then mail items in each folder.

Has anyone done anything with copying an O365 Mailbox offline to a .pst file?

thinkjohn
  • 33
  • 8
  • Do none of the many methods found by googling for "export O365 mailbox to .pst" work for you? – Andrew Morton Dec 06 '22 at 19:35
  • Just to clarify here, the end goal you're really after is a way to export the mailbox. Doesn't matter if it's via code or some other tooling? – Hursey Dec 06 '22 at 20:17
  • I do not have access to the mailbox via outlook. Only O365 Exchange Admin and Exchange Web Services. I would rather not use any of the eDiscovery tools. – thinkjohn Dec 07 '22 at 13:53

2 Answers2

0

You can use the compliance centre to do the export eg https://lazyadmin.nl/office-365/export-office-365-mailbox-to-pst

Another easy solution is to just use the windows Desktop version of Outlook, eg create a profile against the Mailbox, do the export and manually verify it does require a person to do that (assign it to helpdesk etc)

There are lot of third party offering as Andrew mentioned just google them and check the reviews.

Glen Scales
  • 20,495
  • 1
  • 20
  • 23
0

If you already have an Outlook profile that connects to the Exchange mailbox in question, you can simply drag/drop folders/messages from the Exchange mailbox to a PST file.

You can also use Outlook Object Model or Redemption to copy the messages programmatically.

Dmitry Streblechenko
  • 62,942
  • 4
  • 53
  • 78
  • I would like to use redemption along with EWS, but I do not know how to go about doing it. Are there any samples? – thinkjohn Dec 07 '22 at 13:55
  • So are you planning to use EWS to connect to the Exchange mailbox and Redemption to create a PST file? Or are you planning to both access the mailbox and create the PST file using Redemption? – Dmitry Streblechenko Dec 07 '22 at 17:34
  • I would like to try EWS to connect to the mailbox and Redemption to create the PST file? – thinkjohn Dec 08 '22 at 12:56
  • That should work - connect to the mailbox using EWS, export the messages in the FTS (Fast Transfer Stream) format using `ExportItems` EWS operation. For the PST file, create one using `RDOSession.LogonPstStore`, add folders and messages, import the exported data using `RDOMail.Import(..., olFts)` – Dmitry Streblechenko Dec 08 '22 at 16:26