3
votes

I'm building an application for collecting statistical information from emails inside organizations. Let's assume that those organizations use Outlook 365. I want to be able to do the following in the easiest way:

  • Get permissions to read all the mails in an organization
  • Get the emails + attachments and run my statistics

It seems that there is no easy way to do it with Outlook 365. I found this: any-office-365-rest-api-to-get-messages-from-all-mailboxes-in-an-organization , but I don't understand if it can work for any organization using Outlook 365. Am I wrong? How can I install such an app on a random organization and receive all the permissions?

I thought of another solution which has it's drawbacks but is quite easy: The organization creates an email address for me, e.g [email protected], and define in the Exchange 365 to forward all emails to this address. Then I can get use the Outlook 365 REST API to get all emails and delete those that I went over. The main drawback is that I'm afraid that this email box will get full to quickly and I'll miss many emails. According to this , the email box should have 50 GB which is a big enough buffer.

Is there a normal way to do this? Did anyone come across such a problem?

Thanks a lot.

1

1 Answers

1
votes

You need to create a mutlitenant application on Azure AD.

If you want your app to be able to read all emails in the organization (not the emails of the user that have already logged and grant your app). You need to add the following permission to the application: Read Mail in All mailboxes (see image)

Remark that this scope is admin_consent only. Then your app needs to be validated by an administrator of the Office 365 tenant. You can read more about this here.

Azure AD application configuration