Get All Sites and Sub Sites using REST API

This post will explain you how to Get All Sites and Sub Sites using REST Api in SharePoint Online

In order to get the list of sub sites from a site we need to call the below URL:

Now to get the entire site structure we will need to loop every site to see if there are any sub sites present.

Below is the code I have used.

//The First Ajax is to get the Root Site Title and the Relative URL

// The Second AJAX is to get all the sub sites under the Root Site

// This is a Recursive Function to loop through the sub sites and check for more sub sites

Reference link :

http://sharepoint.stackexchange.com/questions/92467/retrieve-toplevel-sites-subsites-using-rest-api

3 thoughts on “Get All Sites and Sub Sites using REST API

Leave a Reply

Your email address will not be published. Required fields are marked *