I am exploring an option to see if it's possible to get messages from all mailboxes in an organization (i.e within a domain) using Office 365 Mail REST APIs or if there is any other way to easily get these messages.
These are the options I have explored: 1) bcc all emails to a particular account and then get messages from bcc account. 2) Explored the connector option to send all mails to another email server. 3) I also saw in other posts which advises to create an Admin account/security group and give that account the full access to all mailboxes in an org using power shell but this option seems very inconvenient as new mailbox could get added so the power shell would need to be run again and also even if the Admin user is given full access still when REST API is used to get message then it will only get message form Admin account's mailbox and not from all mailboxes in an org.
So I was wondering is if it's possible to get all emails of an organization using Office 365 REST API or some other feasible and cleaner way?