Search code examples
sharepointmicrosoft-graph-api

How to retrieve "DocIcon" and "Taxonomy" values of items in subfolders?


I am trying to retrieve values for "DocIcon" and "Taxonomy" in a single call for items inside subfolders. Currently, I am using the following call to retrieve these values for items in the main list:

https://graph.microsoft.com/v1.0/sites/{site-id}/lists/{list-id}/items?expand=fields

However, this call does not return values for items inside subfolders.

For the items inside subfolders, I have tried using the following call:

https://graph.microsoft.com/v1.0/sites/{site-id}/drive/items/{folder-id}/children?expand=listItem

This call retrieves the items inside subfolders, but even after I expand for listItem, it does not return values for "DocIcon" and "Taxonomy".

Is there a way to retrieve these values for items inside subfolders? Alternatively, can I modify the first call to retrieve items inside subfolders?

Thank you for your help.


Solution

  • I think you can use nested expand

    /v1.0/sites/{site-id}/drive/items/{folder-id}/children?&expand=listitem(expand=fields)
    
    /v1.0/sites/{site-id}/drive/items/{folder-id}/children?&expand=listitem(expand=fields(select=docicon,taxonomy))