4

I'm looking for a way to get the list of site collections for my O365 Subscriptions. Now I have come across various answers to this but NONE of them works for me. I am using Client Credentials Flow to get the access token which means >>> APP Only Token. I have tried

https://{tenantName}-admin.sharepoint.com/_api/search/query?querytext='contentclass:sts_site'

and I get

500 Internal server error
{
  "error": {
    "code": "-1, Microsoft.Office.Server.Search.REST.SearchServiceException",
    "message": {
        "lang": "en-US",
        "value": "An unknown error occurred."
    }
  }
}

I have come across the following links

And

The last link appeared to be promising and I created the LIST(QueryPropertiesTemplate) as mentioned, but how am I supposed to get the FARM ID? Since this is Sharepoint Online and not on premise.

Any help with this?

Syed Mauze Rehan
  • 594
  • 1
  • 6
  • 23
  • I have found the following to be very helpful for stepping through the process Accessing Tenant ID for Sharepoint Online etc. http://www.ktskumar.com/2017/01/access-sharepoint-online-using-postman/ – Aaron Woods Aug 01 '18 at 16:12

1 Answers1

1

Is it not "-admin" in the URL that is your problem. I tried with my tenant and without admin and got an response. enter image description here

slingshot
  • 11
  • 2
  • If you have a new question, please use the "Ask Question" button at the top of the page. This section is for answers only, not subsequent questions or discussions. Thank You. – Benny Skogberg Dec 04 '18 at 10:31