microsoft-graph-apionedrivemicrosoft-graph-sdks

Graph SDK: using select options on delat (Onedrive)


I am trying to get delta changes in specific One Drive Root using the following MS Graph sdk (v5.56) code.

string url = $"https://graph.microsoft.com/v1.0{resourcePath}/delta?token={urlEncodedTime}";

var deltaresponse = gsc.Drives[driveId].Items["root"].Delta.WithUrl(url).GetAsDeltaGetResponseAsync(rc =>
{
    rc.Headers.Add("Prefer", "deltaExcludeParent");
    rc.QueryParameters.Select = new string[] { "Name", "Deleted", "File", "CreatedDateTime", "LastModifiedDateTime", "ParentReference", "Id", "OdataType" };
}).GetAwaiter().GetResult();

However, I'm getting the full response instead of selected query options.

Please suggest.


Solution

  • When using WithUrl method, any other path and query parameters which you set in requestConfiguration are ignored.

    Specify $select in url property.

    string url = $"https://graph.microsoft.com/v1.0{resourcePath}/delta?token={urlEncodedTime}&$select=name,deleted,file,createdDateTime,lastModifiedDateTime,ParentReference,Id,OdataType";