Tenant Level Search For Outlook via Rest Api

185 views Asked by At

Is there a way to search across all mailboxes in a tenant ? without specifying any particular user? My goal is to search for any test across all mailboxes of a tenant.

I came across this link a : http://www.sharepointtalk.net/2015/02/getting-emails-with-attachments-from.html which is using Sharepoint's search api to search on signed in user's mail boxes.

_api/search/query?querytext='contentclass:exchangeattachment'&properties='GraphQuery:ACTOR(ME)'

But I got this error :

 {
"odata.error": {
"code": "-1, Microsoft.Office.Server.Search.REST.SearchServiceException",
"message": {
    "lang": "en-US",
    "value": "SPO graph API is deprecated."
  }
 }
}

If I remove the 'properties' from api call, there are no search results. Can we access and do we need any special permissions to use Sharepoint Search Rest API to search on outlook messages ? and can we search across tenant using this api

I know we can search on messages using this api graph api call :

https://graph.microsoft.com/v1.0/users//messages?$search="" But I want the search to work independent of the signed in user. is this possible ? Thanks.

1

There are 1 answers

0
Shiva Keshav Varma On

Please go through this document to know when you can get the data from /messages endpoint and yes you can use application permissions to look into messages without user login but its still individual mailboxes you can do but not at tenant level searching using Microsoft Graph.