question

82658846 avatar image
0 Votes"
82658846 asked saldana-msft edited

Read all Emails Against Search Query For Office365 Outlook

I want to read all emails within my tenant against a query using Office365 Outlook API. Currently, I am enumerating one user at a time and extracting all the emails for it

https://graph.microsoft.com/v1.0/{userId}/messages?$search="from:abc@xyz.com"

This approach is not scalable as in the case of 1000+ users it will take a lot of time. I want to extract the emails for all users against a query but without enumerating individual users.

microsoft-graph-mailmicrosoft-graph-search
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Adding right tags/teams to assist.

0 Votes 0 ·
BrianTJackett avatar image
0 Votes"
BrianTJackett answered

Agreed that that approach isn't as scalable. Have you explored Microsoft Graph data connect? For extracting emails (or other supported data sets) at scale that would be a recommended starting point. If that doesn't meet your needs we'd love to hear your feedback.

Overview of Microsoft Graph data connect - Get access to data at scale
https://docs.microsoft.com/en-us/graph/data-connect-concept-overview#get-access-to-data-at-scale

Get started with Microsoft Graph data connect
https://docs.microsoft.com/en-us/graph/data-connect-get-started?view=graph-rest-1.0


5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

35247258 avatar image
0 Votes"
35247258 answered

Adding to @BrianTJackett comment. Microsoft Graph data connect (MGdc) would also remove the throttling factor and allow you to extract emails in Bulk very quickly. With MGdc you can either extract entities from all users in your tenant or select specific groups. You can also filter out fields for privacy concerns, so if for example you want to extract information about all emails sent but not retrieve the body of those emails, you can.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.