Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/339.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 使用CreateUploadSession上载文件时,服务器返回代码:InternalServerError_C#_Sharepoint_Microsoft Graph Api_Onedrive - Fatal编程技术网

C# 使用CreateUploadSession上载文件时,服务器返回代码:InternalServerError

C# 使用CreateUploadSession上载文件时,服务器返回代码:InternalServerError,c#,sharepoint,microsoft-graph-api,onedrive,C#,Sharepoint,Microsoft Graph Api,Onedrive,我的应用程序可以通过连续上传将文件上传到OneDrive、SharePoint中。 目前,它已损坏,在调用时抛出InternalServerError var uploadSession = await graphClient.Drive.Items["01KGPRHTV6Y2GOVW7725BZO354PWSELRRZ"].ItemWithPath("_hamilton.png").CreateUploadSession().Request().PostAsync(); 我的建议如下: [

我的应用程序可以通过连续上传将文件上传到OneDrive、SharePoint中。 目前,它已损坏,在调用时抛出InternalServerError

var uploadSession = await graphClient.Drive.Items["01KGPRHTV6Y2GOVW7725BZO354PWSELRRZ"].ItemWithPath("_hamilton.png").CreateUploadSession().Request().PostAsync();
我的建议如下: [

例外情况:

Status Code: InternalServerError
Microsoft.Graph.ServiceException: Code: InternalServerError
Message: Object reference not set to an instance of an object.
Inner error:
AdditionalData:
request-id: b3ab4fbb-e3c2-4e07-a353-4e2a73b5bf67
date: 3/10/2020 4:25:56 AM
ClientRequestId: b3ab4fbb-e3c2-4e07-a353-4e2a73b5bf67

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)

SDK:Microsoft.Graph 1.21.0

我们也遇到了同样的问题,但这似乎是Graph API的一个问题,它(可能)在今天(2020-03-10)发生了变化。有人提出了一个github问题,您可以关注这个问题,但如果您真的必须这样做,您可以通过使用反射覆盖请求url来绕过它

var regex=new regex(@“/microsoft\.graph\.createUploadSession$”;
var reqUrl=uploadSessionReq.RequestUrl;
类型(DriveItemCreateUploadSessionRequest)
.GetProperty(名称(DriveItemCreateUploadSessionRequest.RequestUrl))
.GetSetMethod(非公开:true)
.调用(
uploadSessionReq,
新[]
{
regex.Replace(reqUrl,“/createUploadSession”)
}
);

谢谢Andreas。github中的问题是由我创建的。现在,问题已由所属团队解决。