.net - MS Graph 客户端库,删除 UploadSession
问题描述
使用 Microsoft Graph 客户端库 1.21.0,我找到了如何创建上传会话的示例。但我找不到如何使用库删除上传会话的示例。请指教。
private UploadSession CreateUploadSession(string relativeName)
{
UploadSession uploadSession = null;
try
{
uploadSession = Task.Run(() => Client.Drives[DriveId].Items[RootPathId]
.ItemWithPath(relativeName)
.CreateUploadSession()
.Request()
.PostAsync())
.Result;
}
catch (AggregateException ae)
{
ae.Handle(ex =>
{
if (ex is ServiceException && ((ServiceException)ex).IsMatch(GraphErrorCode.NameAlreadyExists.ToString()))
{
// An upload session already exists. Delete it and try again.
return true;
}
else
{
return false;
}
});
}
return uploadSession;
}
解决方案
推荐阅读
- coldfusion - bit.ly URL Reduction 服务突然无法正常工作
- javascript - 获取所有数组的唯一项目 - Handlebars
- ruby - 连接两个哈希值以在 ruby 中形成哈希
- android - 如何实施 Google In App Billing 以仅向付费用户提供对 Firebase 中高级内容的访问权限
- xcode - 无法将项目连接到模拟器
- angular - Angular *ngFor 直接从服务访问数组
- css - 如何使图像引脚响应背景?
- kotlin - 从响应中提取值并填充到 Kotlin
- javascript - 通过 Angular 或 Javascript 打开桌面应用程序
- python - 当数据以空字符串开头时开始串行读取