【问题标题】:Microsoft Graph Delta information only after second callMicrosoft Graph Delta 信息仅在第二次调用后
【发布时间】:2022-01-20 08:39:33
【问题描述】:

我想知道Microsoft Graph中使用Delta的最后修改的文件,我实现了如下:

 //...
 private static object DeltaLink = null;
 private static IDriveItemDeltaCollectionPage lastPage = null;
 private async Task<IDriveItemDeltaCollectionPage> GetFiles(GraphServiceClient graphClient, object deltaLink)
 {
     IDriveItemDeltaCollectionPage page;
     if (lastPage == null)
     {
         var queryOptions = new List<QueryOption>() {
         new QueryOption("token", "latest"),
         new QueryOption("$select", "name,id")
         };
         page = await graphClient.Drives["{Drive-Id}"]
                                 .Items["{Folder-Id}"]
                                 .Delta()
                                 .Request(queryOptions)
                                 .GetAsync();
     }
     else
     {
         lastPage.InitializeNextPageRequest(graphClient, deltaLink.ToString());
         page = await lastPage.NextPageRequest.GetAsync();
     }
     lastPage = page;
      
     return page;
 }

问题是我只有在第二次调用 Delta 后才能获得有关文件更改的信息。但是我怎么知道我在第一次通话时就已经获得了信息?

【问题讨论】:

    标签: c# microsoft-graph-api microsoft-graph-sdks


    【解决方案1】:

    这是因为token=latest 在第一次调用中返回带有最新增量令牌的空响应,然后您需要进行第二次调用以获取最新更改。

    此行为是设计使然。

    资源:

    Use delta query

    driveItem delta function parameters

    【讨论】:

    • 是的,我很害怕,但是没有token=latest,我会得到所有已更改的文件,这也不太理想。
    猜你喜欢
    • 1970-01-01
    • 2022-07-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多