2

I want to know if there is any way I can get the entire list of My Sites (personal sites) with in the My Site collection for a tenant.

So I'm looking for all sites under

https://{tenantName}-my.sharepoint.com

site collection for a tenant. I have come across various answers saying I could do a search query on STS_Site but please not that I am using App Only Token and that doesn't work for App Only Access Token (i.e, for Client Credentials Flow)

Isn't there any other way through REST API that I can get this list?

https://{tenantName}-my.sharepoint.com/personal/abc_domain_com
https://{tenantName}-my.sharepoint.com/personal/pqr_domain_com
https://{tenantName}-my.sharepoint.com/personal/xyz_domain_com
...

I was hoping this would give me the sites under My Site Collection

https://{tenantName}-my.sharepoint.com/_api/web/webs

but I get the following

{
    "d": {
    "results": []
    }
}

Much appreciated!

PS: I even tried Authorization Code Grant Flow to get the access token and did a search query for STS_Site content type, but it doesn't return me the entire list, just a subset! The user I made the search query with is the Global Admin so this info should be entirely available but it isn't. The Authorization Code Grant Flow is not of much use to me because of certain limitations(one of them is the visibility of sites like above and some others). So I am more interested in finding a solution using Client Credentials Flow (App Only Access Token)

Is there a way?

2
  • Personal sites are all different site collections by themselves, so you can't get them using webs.
    – Akhoy
    Commented Aug 8, 2015 at 16:03
  • Yes indeed. But isn't there any way to get these list of sites? Commented Aug 9, 2015 at 5:03

1 Answer 1

1

I know this isn't the REST API and so may not meet your needs but this is easy to do with the PowerShell module for o365 Sharepoint ( https://docs.microsoft.com/en-us/powershell/sharepoint/sharepoint-online/connect-sharepoint-online?view=sharepoint-ps )

Install and connect to SPO via Powershell and then

$AllSites = Get-SPOSite -IncludePersonalSite:$true -Limit All
$AllSites | ? Url -LIKE "*/personal/*"

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.