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

假装没事ソ 提交于 2020-01-11 07:12:48

问题


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 for the child items.

https://graph.microsoft.com/beta/sites/<site-id>/drive/root/children

I have tried using ?expand=... without success. Is this possible with either the v1 or beta endpoints?


回答1:


Endpoint GET https://graph.microsoft.com/beta/sites/<site-id>/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


来源:https://stackoverflow.com/questions/55071910/how-to-access-custom-columns-in-a-sharepoint-library-graph-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!