I have a list with items in SharePoint Online. There many items and their structure look like a tree.


How can I get a parent guid of the itemX by REST or GraphAPI? (for example)

Actually, I have to get a hierarchy of items on the List. But SharePoint API provides children of a List, but not their hierarchy. Is it possible to get?

2 Answers 2


For Item-


For Site-


  • It doesn't work. { "error": { "code": "-1, Microsoft.SharePoint.Client.ResourceNotFoundException", "message": { "lang": "en-US", "value": "Cannot find resource for the request ParentID." } } } Apr 20, 2021 at 10:52

You can follow below steps to get the parent folder's GUID. You will require 2 calls to do so:

  1. Use below REST API to access the actual item. In that you will have file directory reference. This will be used to access your parent folder of item. i.e.: itemX


In the output: you will have relative path of the parent folder. Use that path in 2nd step.

  1. Create REST API to access GUID of the parent folder as below:

https://<site-url>/_api/web/getfolderbyserverrelativeurl('<pass the relative path of the parent folder>')/listitemallfields/GUID


<d:GUID xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:georss="http://www.georss.org/georss" xmlns:gml="http://www.opengis.net/gml" m:type="Edm.Guid">70870a3f-2f73-4ad9-b5ac-8eeba2d823b0</d:GUID>

  • It returns the item properties. Apr 20, 2021 at 11:26
  • But I need a parent GUID of the item Apr 20, 2021 at 11:27
  • Please check my updated answer to get parent folder's GUID. Apr 20, 2021 at 11:47
  • Yes, it should work. But I prefer to use one request. Because there Throttling limits Apr 20, 2021 at 11:53
  • 1
    In that case, you can get all the items from list with their directory path & GUID. Then manipulate them within json array to identify the guid of the parent of your item. Because there is no such API I found that gives parent GUID details during actual item fetch. Apr 20, 2021 at 12:00

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.