Describe the different steps for connecting Magic xpi with Office365 using REST Microsoft Graph API
1/ Define in Azure Portal An app registration and add permission for Office365 via Microsoft Graph

Retrieve the ClientId, ClientSecret, TenantId in other to define this settings in the Magic xpi Resource Repository
2/ Open the Resource repository in Magic xpi Studio
Define all the settings like below
Set the scope with : offline_access IMAP.AccessAsUser.All

3/ Click on the Paths Button and define 4 endpoints
/users/{id}/mailfolders/inbox/messages
/users/{id}/mailfolders/inbox/messages/{messageid}/attachments/{attachid}/$value
/users/{id}/mailfolders/inbox/messages/{messageid}/attachments
/{attachment_path}

4/ Drag and Drop a REST Client connector and use /users/{id}/mailfolders/inbox/messages endpoint

Set the Id with the User uuid
(*) You can make a GET on https://graph.microsoft.com/v1.0/users/{Mailbox] to retrieve the UserUUID

5/ Drag and Drop Datamapper connector to make a loop in other to download Mail attachments by calling a Subflow and passing the Id
(*) In the example, we process only Mails that has attachment

6/ In the called subflow, Make a GET on this URL : /users/{id}/mailfolders/inbox/messages/{messageid}/attachments

Click OK and pass the MessageID and User UUID

7/ Parse the JSON response and call another subflow to download Mail Attachment by passing the Name and AttachmentID

8/ In the second subflow, make a get on this URL : /{attachment_path}

set attachment_path : ‘/users/{User UUID}/mailfolders/inbox/messages/{MessageId}/attachments/{AttachId}/$value‘

Use the FileManagment to save the file content locally
