access mails in exchange online mailbox

Iron Contributor

Can I access (I like to save the email as a file) the mails in a mailbox online using Powershell via Exchange online?The necessary permissions are required.

3 Replies

You need to provide more context here, what exactly are you trying to achieve? Is this for your own mailbox or somebody else's? What operations will you need to perform on the items? Generally speaking, PowerShell will not help here, as it doesnt provide any item-level operations. You can however "wrap" EWS/Graph API code within PowerShell and do pretty much everything you want.

@Vasil Michev 

 

Many thanks for the answer.

Under the inbox a folder structure should be cleaned up

Inbox
    abc
         one
         two

Now I want to look into every mailbox and do this with all emails in the folder "abc":
- save the email as MSG file in a folder structure
- edit the subject of the email with a marker

I have already implemented this with Powershell and Outlook. But I don't like the implementation because I would like to use it as a central service.

So yeah, the EWS API is what you should be looking for. To manage other mailboxes, you will need either Full Access permissions, or impersonation. You can call the EWS API from within PowerShell if needed.