Best way to get emails in an organization using the Outlook 365 API
<p>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:</p>

<ul>
<li>Get permissions to read all the mails in an organization</li>
<li>Get the emails + attachments and run my statistics</li>
</ul>

<p>It seems that there is no easy way to do it with Outlook 365.
I found this: <a href="https://stackoverflow.com/questions/37492806/any-office-365-rest-api-to-get-messages-from-all-mailboxes-in-an-organization">any-office-365-rest-api-to-get-messages-from-all-mailboxes-in-an-organization</a> , 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?</p>

<p>I thought of another solution which has it's drawbacks but is quite easy:
The organization creates an email address for me, e.g mails@org.com, 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 <a href="https://technet.microsoft.com/en-us/library/exchange-online-limits.aspx" rel="nofollow noreferrer">this</a> , the email box should have 50 GB which is a big enough buffer.</p>

<p>Is there a normal way to do this? Did anyone come across such a problem?</p>

<p>Thanks a lot.</p>