sharepointmicrosoft-graph-sdkskiota

Running delta queries using Microsoft.Grpah c# sdk 5.^


Trying to run delta queries for SharePoint drive root using new Microsoft.Graph version 5.0.0 nuget package. Seems the Delta function is missing from the Drive API. Is there any way to do delta queries using the new C# SDK?


Solution

  • I think you need to make one extra call. Assume that you have siteId.

    Get drive for the site, then get drive item of the root and then use id of root drive item to get delta.

    // get site drive
    var drive = await graphServiceClient.Sites[siteId].Drive.GetAsync();
    
    // get root drive item
    var rootDriveItem = await graphServiceClient.Drives[drive.Id].Root.GetAsync();
    
    // get delta response for root drive item
    var deltaResponse = await graphServiceClient.Drives[drive.Id]
                               .Items[rootDriveItem.Id]
                               .Delta
                               .GetAsync();