When trying to access the search endpoint (https://example.sharepoint.com/_api/search/query) I always manage to bump into exceptions. I can't seem to find any reference to what is the correct App permissions XML that I should use for the App Principal.

I have tried this:

  <AppPermissionRequest Scope="http://sharepoint/search" Right="QueryAsUserIgnoreAppPrincipal" />

And I got this:

System.UnauthorizedAccessException: Access denied. You do not have permission to perform this action or access this resource.

and I also tried this:

<AppPermissionRequests AllowAppOnlyPolicy="true">
    <AppPermissionRequest Scope="http://sharepoint/content/sitecollection" Right="Read" />

and I got this:

Microsoft.Office.Server.Search.REST.SearchServiceException: Application does not have administrative permissions in tenant

Any ideas on how should the XML look like, to have the minimum permissions to allow access to the query api endpoint?

1 Answer 1


This article from Vesa Juvonen tells exactly what you need to do. I assume you've seen this it since it was my first result on a Google search. He says you need

 <AppPermissionRequest Scope="http://sharepoint/content/tenant" Right="FullControl" />

and he says you need to add the permission XML in the admin site collection (i.e., https://[tenant]-admin.sharepoint.com/_layouts/15/appinv.aspx). Have you tried this?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.