Copilot for Microsoft 365 Tech Accelerator
Feb 28 2024 07:00 AM - Feb 29 2024 10:30 AM (PST)
Microsoft Tech Community

How can I search by subject in all users' emails?

Copper Contributor

I am trying to search mails in all users mailbox by subject. I am trying to use "searchEntity: query": https://docs.microsoft.com/en-us/graph/api/search-query?view=graph-rest-1.0

 

To be able to use "searchEntity: query" i need this permissons: Mail.Read, Calendars.Read, Files.Read.All, Sites.Read.All, ExternalItem.Read.All

 

But there is no ExternalItem.Read.All permission on azures request api permissions.

Nocebo_0-1623419296486.png

 

1. How can i solve this issue
2. Is there another way to search mails in all users' emails?
2 Replies
ExternalItem.Read.All is a delegate-level permission, you seem to be looking at the application-level ones. If your goal is to search mailboxes, I'd stick to the Mail API endpoints and/or EWS.
Or using compliance center and content search is the easiest way to search all mailboxes. Assuming you have the permission and access needed. But same goes for searching mailboxes any other way you need to access but with compliance center if you have the role you have access to search all boxes easily.