3
使用:驱动版:1.5.0.99 Beta版,.NET框架:4.5谷歌云端硬盘API V2:InsertMediaUpload - 空响应收到
认证进行正确(使用模拟) - 通过服务帐户(AssertionFlowClient)。 获取访问令牌。服务帐户已被授予域宽特权
我能够通过Service.Files.List()获取父文件夹 - ID(strRootFolder);
byte[] byteArray = System.IO.File.ReadAllBytes(FileName);
Google.Apis.Drive.v2.Data.File flUpload = new Google.Apis.Drive.v2.Data.File();
flUpload.Title = Title;
flUpload.Description = Description;
flUpload.MimeType = MimeType;
flUpload.Parents = new List<ParentReference>() { new ParentReference() { Id = strRootFolder } };
Google.Apis.Drive.v2.FilesResource.InsertMediaUpload drvRequest = drvService.Files.Insert(flUpload, new System.IO.MemoryStream(byteArray), "text/plain");
drvRequest.Upload();
但是Upload方法不发送任何请求。没有例外被抛出。 Fiddler跟踪显示没有请求已发送,因此request.responsebody始终为空。
我错过了什么吗?
没有异常被抛出 - 什么也没有发生。 ResponseBody为null – Prasanna
返回对象包含什么?它有Status,Exception和BytesSent。每个属性包含哪些内容? – peleyal
已设法解决此问题。通过UploadAsync,它引发了一个例外,即ZLibPortable引用不可用。然而,使用InsertMediaUpload.Upload方法,它不会抛出任何异常,也不会发送任何请求 - 只返回null。看起来像InsertMediaUpload需要一些修复。如果添加ZLibPortable Ref,则InsertMediaUpload.Upload可以正常工作。 – Prasanna