I have the following code which was working nicely until recently
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);
}
}
All of a sudden we are getting this:
System.NullReferenceException: Object reference not set to an instance of an object. at Microsoft.Graph.HttpProvider.SendAsync(HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken) at Microsoft.Graph.BaseRequest.SendRequestAsync(Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption) at Microsoft.Graph.BaseRequest.SendAsync[T](Object serializableObject, CancellationToken cancellationToken, HttpCompletionOption completionOption) at xyz.CreateFolderIfNotExists(GraphServiceClient graphClient, String driveId, String folderName) in xyz\Client\SharePointClient.cs:line 63 at xyz.Client.SharePointClient.CopyLegacyFile(String fileId, String destination, String newFileName, String documentLibraryId) xyz\Client\SharePointClient.cs:line 222 at xyz.SharePointDocumentStorage.New() in xtz\SharePointDocumentStorage.cs:line 56 at zzzWorkflowAppService.NewRevision(NewRevisionInput input) at Abp.Authorization.AuthorizationInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation) at Abp.Domain.Uow.UnitOfWorkInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation) at Abp.EntityHistory.EntityHistoryInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation) at Abp.Auditing.AuditingInterceptor.InternalInterceptAsynchronous[TResult](IInvocation invocation) at Abp.Runtime.Validation.Interception.ValidationInterceptor.InternalInterceptAsynchronou...
Any idea whats happening? There was no code push to cause this.
It is not a duplicate of What is a NullReferenceException, and how do I fix it?