PS script to scrape mailbox metadata?

Copper Contributor



Thank you for reading this post.


I have been scouring the web for some sort of script or reporting tool that will scrape a specified Exchange Online mailbox (preferably a folder) for email metadata to export into a CSV.  Data for each email such as: from, to, cc(s), date/time sent/received, subject line, email attachment name(s), importance.


Any help is appreciated.


Thank you!

3 Replies


I guess before getting the message, the user that will execute the script should have a full control (delegation) to access the mailbox.

But I guess there are alot of information can be retrive from Get-MessageTracking log.

Let me know, and I will try to write a PS Script that dump the header for you.

by that time, we will see if other expert have a different word.

@farismalaeb Thank you for looking into this for me.


I've tried out the script but unfortunately there are many errors and reading the blog comments it seems like the script has not been updated in quite some time and the creator feels as though it won't work with the current backend anymore...


I do see that this person has updated the original script a bit to move emails around -


When I run this I do not get any errors, but it does not do what I'm looking for it to do.... Instead of moving emails around, I want it to populate a CSV with email metadata from a specific folder.