【发布时间】:2021-03-08 12:36:46
【问题描述】:
我有以下代码,直到最近都运行良好
private async Task<DriveItem> CreateFolderIfNotExists(GraphServiceClient graphClient, string driveId, string folderName)
{
try
{
var driveItem = new DriveItem
{
Name = folderName,
Folder = new Folder(),
AdditionalData = new Dictionary<string, object>()
{
{ "@microsoft.graph.conflictBehavior", "fail" }
}
};
return await graphClient.Drives[driveId].Root.Children
.Request()
.AddAsync(driveItem);
}
catch (ServiceException exception)
{
if (exception.StatusCode != HttpStatusCode.Conflict)
{
throw;
}
return await this.GetFolderItem(graphClient, driveId, folderName);
}
}
突然间我们得到了这个:
System.NullReferenceException:对象引用未设置为对象的实例。在 Microsoft.Graph.HttpProvider.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancelToken) 在 Microsoft.Graph.BaseRequest.SendRequestAsync(Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption) 在 Microsoft.Graph.BaseRequest.SendAsync[T](Object serializableObject ,xyz\Client\SharePointClient.cs 中 xyz.CreateFolderIfNotExists(GraphServiceClient graphClient, String driveId, String folderName) 处的 CancellationTokencancellationToken, HttpCompletionOption completionOption):xyz.Client.SharePointClient.CopyLegacyFile (String fileId, String destination, String newFileName) 处的第 63 行字符串 documentLibraryId) xyz\Client\SharePointClient.cs:xyz.SharePointDocumentStorage.New() 中 xtz\SharePointDocumentStorage.cs 中的第 222 行:zzzWorkflowAppService.NewRevision(NewRevisionInput 输入) 中 Abp.Authorization.AuthorizationInterceptor.InternalInterceptAsynchronous[T] 中的第 56 行结果](IInvocation 调用)在 Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation 调用)在 Abp.EntityHistory.EntityHistoryInterceptor.InternalInterceptAsynchronous[TResult](IInvocation 调用)在 Abp.Auditing.AuditingInterceptor.InternalInterceptAsynchronous[TResult]( IInvocation 调用)在 Abp.Runtime.Validation.Interception.ValidationInterceptor.InternalInterceptAsynchronou...
知道发生了什么吗?没有代码推送导致此问题。
它不是What is a NullReferenceException, and how do I fix it?的重复项
【问题讨论】:
标签: sharepoint microsoft-graph-api