How to access custom columns in a sharepoint library - graph API

前端 未结 1 1516
攒了一身酷
攒了一身酷 2021-01-16 04:16

I am listing the children in the root of a document library with custom columns. When I make the following call with the MS graph REST API, no custom column data is returned

1条回答
  •  北恋
    北恋 (楼主)
    2021-01-16 04:36

    Endpoint GET https://graph.microsoft.com/beta/sites//drive/root/children returns the collection of files metadata (DriveItem resource) in the root of the drive.

    The associated document library list items could be retrieved via DriveItem.listItem property including the values of the columns set on this list item (via ListItem.fields property) like this:

    https://graph.microsoft.com/v1.0/sites/root/drive/root/children?$expand=listItem($expand=fields) 
    

    Alternatively, SharePoint Library list items and column values (including custom ones) could be retrieved instead:

    GET https://graph.microsoft.com/v1.0/sites/root/drive/list/items?$expand=fields
    

    or list items along with files metadata:

    GET https://graph.microsoft.com/v1.0/sites/root/drive/list/items?$expand=fields,driveItem
    

    0 讨论(0)
提交回复
热议问题