PS script to scrape mailbox metadata?

%3CLINGO-SUB%20id%3D%22lingo-sub-1659004%22%20slang%3D%22en-US%22%3EPS%20script%20to%20scrape%20mailbox%20metadata%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1659004%22%20slang%3D%22en-US%22%3E%3CP%3EHello%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20reading%20this%20post.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20have%20been%20scouring%20the%20web%20for%20some%20sort%20of%20script%20or%20reporting%20tool%20that%20will%20scrape%20a%20specified%20Exchange%20Online%20mailbox%20(preferably%20a%20folder)%20for%20email%20metadata%20to%20export%20into%20a%20CSV.%26nbsp%3B%20Data%26nbsp%3Bfor%20each%20email%20such%20as%3A%20from%2C%20to%2C%20cc(s)%2C%20date%2Ftime%20sent%2Freceived%2C%20subject%20line%2C%20email%20attachment%20name(s)%2C%20importance.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EAny%20help%20is%20appreciated.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1659004%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExchange%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1660354%22%20slang%3D%22en-US%22%3ERe%3A%20PS%20script%20to%20scrape%20mailbox%20metadata%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1660354%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F790512%22%20target%3D%22_blank%22%3E%40MikeDigHip%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20guess%20before%20getting%20the%20message%2C%20the%20user%20that%20will%20execute%20the%20script%20should%20have%20a%20full%20control%20(delegation)%20to%20access%20the%20mailbox.%3C%2FP%3E%3CP%3EBut%20I%20guess%20there%20are%20alot%20of%20information%20can%20be%20retrive%20from%20Get-MessageTracking%20log.%3C%2FP%3E%3CP%3ELet%20me%20know%2C%20and%20I%20will%20try%20to%20write%20a%20PS%20Script%20that%20dump%20the%20header%20for%20you.%3C%2FP%3E%3CP%3Eby%20that%20time%2C%20we%20will%20see%20if%20other%20expert%20have%20a%20different%20word.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1662136%22%20slang%3D%22en-US%22%3ERe%3A%20PS%20script%20to%20scrape%20mailbox%20metadata%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1662136%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F790512%22%20target%3D%22_blank%22%3E%40MikeDigHip%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3ETry%20this%20one.'%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsysadminben.wordpress.com%2F2015%2F10%2F27%2Freading-emails-from-office365-account-using-powershell%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsysadminben.wordpress.com%2F2015%2F10%2F27%2Freading-emails-from-office365-account-using-powershell%2F%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1665365%22%20slang%3D%22en-US%22%3ERe%3A%20PS%20script%20to%20scrape%20mailbox%20metadata%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1665365%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F790105%22%20target%3D%22_blank%22%3E%40farismalaeb%3C%2FA%3E%26nbsp%3BThank%20you%20for%20looking%20into%20this%20for%20me.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI've%20tried%20out%20the%20script%20but%20unfortunately%20there%20are%20many%20errors%20and%20reading%20the%20blog%20comments%20it%20seems%20like%20the%20script%20has%20not%20been%20updated%20in%20quite%20some%20time%20and%20the%20creator%20feels%20as%20though%20it%20won't%20work%20with%20the%20current%20backend%20anymore...%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI%20do%20see%20that%20this%20person%20has%20updated%20the%20original%20script%20a%20bit%20to%20move%20emails%20around%20-%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Fgeekdudes.wordpress.com%2F2019%2F04%2F23%2Fpowershell-extract-email-body-stored-in-custom-folder-using-ews-office-365%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fgeekdudes.wordpress.com%2F2019%2F04%2F23%2Fpowershell-extract-email-body-stored-in-custom-folder-using-ews-office-365%2F%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EWhen%20I%20run%20this%20I%20do%20not%20get%20any%20errors%2C%20but%20it%20does%20not%20do%20what%20I'm%20looking%20for%20it%20to%20do....%20Instead%20of%20moving%20emails%20around%2C%20I%20want%20it%20to%20populate%20a%20CSV%20with%20email%20metadata%20from%20a%20specific%20folder.%3C%2FP%3E%3C%2FLINGO-BODY%3E
New Contributor

Hello,

 

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

@MikeDigHip 

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 - https://geekdudes.wordpress.com/2019/04/23/powershell-extract-email-body-stored-in-custom-folder-usi...

 

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.