access mails in exchange online mailbox

%3CLINGO-SUB%20id%3D%22lingo-sub-1822330%22%20slang%3D%22en-US%22%3Eaccess%20mails%20in%20exchange%20online%20mailbox%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1822330%22%20slang%3D%22en-US%22%3E%3CP%3ECan%20I%20access%20(I%20like%20to%20save%20the%20email%20as%20a%20file)%20the%20mails%20in%20a%20mailbox%20online%20using%20Powershell%20via%20Exchange%20online%3FThe%20necessary%20permissions%20are%20required.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1822330%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAdmin%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExchange%20Online%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EExchange%20Server%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOffice%20365%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1823937%22%20slang%3D%22en-US%22%3ERe%3A%20access%20mails%20in%20exchange%20online%20mailbox%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1823937%22%20slang%3D%22en-US%22%3E%3CP%3EYou%20need%20to%20provide%20more%20context%20here%2C%20what%20exactly%20are%20you%20trying%20to%20achieve%3F%20Is%20this%20for%20your%20own%20mailbox%20or%20somebody%20else's%3F%20What%20operations%20will%20you%20need%20to%20perform%20on%20the%20items%3F%20Generally%20speaking%2C%20PowerShell%20will%20not%20help%20here%2C%20as%20it%20doesnt%20provide%20any%20item-level%20operations.%20You%20can%20however%20%22wrap%22%20EWS%2FGraph%20API%20code%20within%20PowerShell%20and%20do%20pretty%20much%20everything%20you%20want.%3C%2FP%3E%3C%2FLINGO-BODY%3E
Regular 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.