1

I'm using the REST Files API, as documented here, to read the content of an Online Sharepoint (Office 365) site.

Is it possible to get the sub-sites the root site using this API?

I understand I can get a list of sub-sites using the traditional SharePoint API (https://<my-domain>.sharepoint.com/_api/site/rootWeb/webinfos), but I'd rather use the files API because I'm using it for other purposes as well.

(Note that the two APIs are very different. One example: getting the child-elements of a folder in the files API is done using GET {base-url}/Files/{folder-id}/children, which it's done using http://<site url>/_api/web/getfolderbyserverrelativeurl('/<folder name>')/folders in the 'classic' API).

In addition, once I get the list of sub-sites - using the above endpoint or any other means - is it possible to traverse / read these sub-sites using the files REST API?

2
  • This is the REST endpoint https://<my-domain>.sharepoint.com/_api/web/webinfos What sort of content are you intent on reading from the subsites? Commented Jul 18, 2015 at 15:53
  • I'd like to read all the documents and their content. Commented Jul 18, 2015 at 16:45

2 Answers 2

0

This is the REST endpoint https://<my-domain>.sharepoint.com/_api/web/webinfos

You can read the content of subsites by using the %site%/_api/web/ endpoint; e.g: %site%/_api/web/lists

Reference: https://msdn.microsoft.com/en-us/library/office/dn499819.aspx

2
  • Thanks, but this doesn't use the REST Files API I was referring to. Commented Jul 19, 2015 at 6:09
  • 1
    Try using https://<site url>/_api/web/GetFolderByServerRelativeUrl('/Folder Name')/Files('file name')/$value Commented Jul 19, 2015 at 20:39
0

To list the subsites for a site, you would use the Microsoft Graph Sites and lists API, not the Microsoft Graph Files API.

See List subsites for a site for more information.

For example, I have a site collection at /sites/Demo2 in my developer tenant. To list the subsites of this site, I would make a request to:

https://graph.microsoft.com/v1.0/sites/robwindsortest980.sharepoint.com:/sites/Demo2:/sites

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.