Hi @Soni Samuel Panackacheril ,
Driveitem doesn't have fields relationship only listItem has.
You can use driveitem relationship listItem this example will get drives root children listitem.
GET /sites/{siteId}/drives/{driveId}/root/children?$expand=listItem
Your Graph SDK code would look as below,
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var children = await graphClient.Sites[{siteId}].Drives[{driveId}].Root.Children
.Request()
.Expand("listItem")
.GetAsync();
To get a driveItems column metadata properties GET /sites/{siteId}/drives/{driveId}/items/{driveItemId}/listItem
.
Also, additionally we can use Sites-Lists to get column values of document library, please note that driveId
and listIdOfDocLibr
will be different.
GET /sites/{siteId}/lists/{listIdOfDocLib}/items?$expand=fields
References:
https://learn.microsoft.com/en-us/graph/api/resources/listitem?view=graph-rest-1.0#relationships
https://learn.microsoft.com/en-us/graph/api/resources/driveitem?view=graph-rest-1.0#relationships
Hope this helps.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Hi @Tong Zhang_MSFT ,
Thank you, I have just one more query. how can I filter for a specific List or Library (Drive) using GraphServiceClient.
Best Regards,
Soni
Hi @Soni Samuel Panackacheril ,
Currently, $filter is not supported on
GET /sites/{id}/lists
orGET /sites/{id}/drives
, consider using Microsoft Graph Search API, search-concept-files.Hope this helps.
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Hello @Soni Samuel Panackacheril , do you need additional assistance? Was the answer helpful? If it was, please accept it and complete the quality survey so that others can find a solution.
Sign in to comment