This topic contains 3 replies, has 3 voices, and was last updated by
October 1, 2014 at 2:43 pm #19272ParticipantPoints: 0Rank: Member
I'm attempting to read the messages from my mailbox using PowerShell 4.
I can open my mailbox, and I can enumerate the folders.
I can't seem to find a way to read messages from the folders, and wonder if anyone has some code they would like to recommend for doing so with Office 365 latest as of this date.
I would like to be able to read messages from my inbox as well as my online archive (which I have not found a way to access as of yet), enumerate them, and be able to output their content (subject, from addresses, message, etc)
-thanks in advance
October 3, 2014 at 5:37 am #19314KeymasterPoints: 1,811Rank: Community Hero
As far as I'm aware (and I could be wrong), the Exchange commands don't include anything for reading content from mailbox items. That would include O365.
However, O365 supports the IMAP protocol. You could certainly use that to access the contents of a mailbox, but there are no native command sfor doing so. /n software's PowerCmdlets may offer an IMAP option.
You might also look at http://blog.pluralsight.com/powershell-to-read-emails, which uses PowerShell *and Outlook* to access mailbox contents.
October 3, 2014 at 1:58 pm #19342ParticipantPoints: 0Rank: Member
Upon changing my approach from remoting to the Office 365 server to looking at Exchange functionality, I discovered the EWS Dll.
It appears that one can use that and obtain just about whatever one wants via the web. I'm sure it is throttled, but should work.
Some links I've found so far:
Reading headers.. this one is just a few inches from what I need, because it already opens the item. Just a matter of looking at the $item.body
Get messages (use with caution — don't know the site yet)
The trick was discovering that Exchange Office 365 could be accessed with the Microsoft.Exchange.Webservices dll, and then
binging for : "powershell microsoft.exchange.webservices.dll" ..
I'll remember that algorithm in the future, since I'm a C#/>net developer. If searches for what you want to do like "powershell read email" don't turn up anything, look up how one would do it in C#, and find the object name, and search for that.
I appreciate this community and all your help.
November 1, 2015 at 3:16 pm #31579ParticipantPoints: 0Rank: Member
Here is some PowerShell code to read emails from O365 with only the .dll file from the EWS required.
Includes reading the body of the email,
The topic ‘How to read the messages from an Office 365 mailbox / archive using Powershell’ is closed to new replies.