.netazuresharepointmicrosoft-graph-apimicrosoft-graph-sdks

How to Retrieve DriveItem by Path (Sharepoint) in .NET Using Microsoft Graph API?


Hey, I am able to retrieve items from a specified path via the REST API from the Graph API. For reference, here is a example request:

https://graph.microsoft.com/v1.0/sites/{{siteID}}/drives/{{driveID}}/root:/MY_PATH:/children

The issue that I am facing is that I am unable to locate an implementation of this within the Graph API in .NET.


Solution

  • If you know driveId, you can directly call drives endpoint.

    https://graph.microsoft.com/v1.0/drives/{driveID}/root:/MY_PATH:/children
    

    v5 SDK

    var driveItem = await graphClient.Drives[driveId].Root.ItemWithPath("path/to/item").GetAsync();
    

    The issue is that the SDK doesn't generate code for some endpoints like /v1.0/sites//{siteID}/drives/{driveID}/*