Home > Net >  Is there a way to view my mailbox (exchange online\365) and its contents (subject, attachments) usi
Is there a way to view my mailbox (exchange online\365) and its contents (subject, attachments) usi

Time:12-04

I would like to gather information from a weekly mail that is being sent to me, and download the attachments from the message automatically using PowerShell. My organization uses cloud 365 and exchange online services.

I'm new to PowerShell and currently learning it, so let me know if anymore info is needed.

CodePudding user response:

You can use Microsoft Graph to get the job one. See Get started with the Microsoft Graph PowerShell SDK for more information.

If you have Outlook installed you may also consider automating Outlook and get all the required data there locally. The PowerShell - Managing an Outlook Mailbox with PowerShell article explains the required steps for that.

The first piece of business is to invoke the Outlook API using code such as the following. This code gives us access to the messaging namespace of the Outlook API, in which typical objects are e-mail messages, Outlook rules and mail folders, among other objects:

Add-Type -assembly "Microsoft.Office.Interop.Outlook"
$Outlook = New-Object -comobject Outlook.Application
$namespace = $Outlook.GetNameSpace("MAPI")
  • Related