I have to create archive (.pst file) for mailbox in Outlook. I use an exchange server 2016. If i do the "microsoft way" (https://support.microsoft.com/en-us/office/archive-items-manually-ecf54f37-14d7-4ee3-a830-46a5c33274f6) i always find mails that aren't transfert to the archive. Cached Exchange Mode are turn off.
I wish to find a way with powershell to access Outlook and the mail box. I want to copy all folders and subfolders name, their hierarchy, to create them on my archive.pst
Then, i want to find all mail prior to a specific date, and copy each mail on the right folder.
Thank to the post here : Powershell - Read and Move mails to archive folder the function "Get-OutlookInBox" could give me mails, but only it seems on Inbox, not the others folders.
Can anyone tell me how to do this ?
Thank in advance
Posts you are referring to use PowerShell scripts that automate Outlook. The OOM has access to the local data only.
Instead, you can use EWS, see Explore the EWS Managed API, EWS, and web services in Exchange for more information. But EWS is discontinued, so now
Graph APIis the best and valid approach for that, read more about that in the Outlook mail API overview article.Here you are free to use a powershell script which searches for items that correspond to your conditions. The
Find/FindNextorRestrictmethods can help with such tasks in Outlook: