Thursday, January 7, 2021

Get all sites and all sub sites using SharePoint online REST API?

 Created Add-in on SharePoint instance with following permission xml

<AppPermissionRequests>

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

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

</AppPermissionRequests>


Used below API to get all sites and subsites

http://devprasad007-admin.sharepoint.com/_api/search/query?querytext='contentclass:STS_Site' &rowlimit=100


https://<site_name>.sharepoint.com/_api/search/query?querytext='contentclass:STS_Site 

Path:"https://<site_name>.sharepoint.com/*"'&rowlimit=500 

No comments:

Post a Comment