microsoft-graph-api - 在将 Mircosoft graphClient 与 delta 查询一起使用时,onedrive 会抛出 Item not found 异常
问题描述
private GraphServiceClient GetGraphClient()
{
var graphClient = new GraphServiceClient(new DelegateAuthenticationProvider((requestMessage) =>
{
// get an access token for Graph
var accessToken = GetAccessToken().Result;
requestMessage
.Headers
.Authorization = new AuthenticationHeaderValue("bearer", accessToken);
return Task.FromResult(0);
}));
return graphClient;
}
私有异步任务 GetFiles(GraphServiceClient graphClient, object deltaLink) { IDriveItemDeltaCollectionPage 页面;
if (lastDrivePage == null)
{
page = await graphClient.Drive.Root
.Delta()
.Request()
.GetAsync();
}
else
{
lastDrivePage.InitializeNextPageRequest(graphClient, deltaLink.ToString());
page = await lastDrivePage.NextPageRequest.GetAsync();
}
lastDrivePage = page;
return page;
}
当此代码要执行时,它会引发异常 Microsoft.AspNetCore.Server.Kestrel[13] Connection id "0HMD5LBBAHEK0", Request id "0HMD5LBBAHEK0:00000002":应用程序引发了未处理的异常。状态代码:未找到 Microsoft.Graph.ServiceException:代码:itemNotFound 消息:未找到项目内部错误:附加数据:日期:2021-11-12T07:06:54 请求 ID:aa304d5e-f731-4c26-af09-704627bb66a2 客户端请求-id:aa304d5e-f731-4c26-af09-704627bb66a2 ClientRequestId:aa304d5e-f731-4c26-af09-704627bb66a2
解决方案
推荐阅读
- javascript - 日期时间选择器标记值
- c# - 在 Foreach 循环中使用谓词生成器时遇到问题
- java - Vaadin Tabsheet 不希望刷新选项卡内容
- javascript - 如何使用 VueJS 动态添加属性?
- ruby - 我可以在 rbenv 中创建沙盒 gem 环境吗?
- ubuntu - 如何在 Ubuntu 16.04 上离线安装 Tensorflow 和 Cuda?
- import - SAP HANA:将数据从 CSV 文件插入/导入表的最高效方式
- c++ - 对指针和常量兼容性的引用
- python - 当验证损失满足某些标准时提前停止
- jquery - 使用 jquery 的 JSON 迭代