$inbox = $folders | Where-Object | `Įxport-Csv ".\mails.csv" -Delimiter "`t" -Encoding utf8 $folders = Get-MgUserMailFolder -UserId $user.Id -All $user = Get-MgUser -Filter "UserPrincipalName eq ''" # get your user id - insert your own primary email address here # Or update the existing module to the latest version ![]() Install-Module Microsoft.Graph -Scope CurrentUser # One-time process: Install the Graph module # atwork.at, Toni Pohl, Christoph Wilfing # export-messages-with-graph-powershell.ps1 For more information with details, see Install the Microsoft Graph PowerShell SDK, Get started with the Microsoft Graph PowerShell SDK, and. You can get it from my GitHub Office 365 scripts repository here, or below. Here I'm just focusing on the PowerShell script, I'm running it on PowerShell Core. Thankfully, my colleague Christoph Wilfing, our PowerShell expert, supported me and did the tricky part of the elegant extraction of the multi-value properties. While the basic idea and the script was simple, I struggled with expanding the data supplied. The goal was to export (almost) all messages from a subfolder "~CoE" of my Inbox: To automate an export, the Microsoft Graph PowerShell module came in at the right time. Knowing Microsoft Graph, this was my first choice. Unfortunately, the relatively new Exchange v2 PowerShell module does not support an email messages export as far as I have seen. That is useless.Īnother task was to automate the export as simply as possible. The graphic shows the first lines of such a CSV file, with the columns headers and no date. The problem for me was, that there is no message date included. Then, the user can select a folder and export all messages to the selected file. ![]() Well, the wizard allows to export messages to a CSV or to a PST file. When opening the File menu in Outlook for the desktop, there is an "Open & Export" menu which has an Import/Export function. Unfortunately, the Outlook method is unsatisfactory. Of course there are many ways to export emails. I noticed that Outlook allows messages to be exported, but the date of the message is missing in the export file! Really? So here is a workaround to quickly export email messages using Graph PowerShell. I had to export email messages from a specific folder in my Outlook mailbox to a CSV file for further processing.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |