C#googledriveserviceaccountdownloadproblem我已经创建了服务账户,我向这个账户暴露了几个文件,一旦我想下载一个文件,它会抛出异常Google.Apis.Requests.RequestErrorBadRequest[400]Error[message[BadRequest]Location[-]Reason[badRequest]Domain[Global]]以上就是C#学习教程的全部内容:C#googledriveserviceaccount下载问题分享,如果对大家有用还需要详细了解C#学习教程,希望大家多多关注——varcertificate=newX509Certificate2("********.p12","notasecret",X509KeyStorageFlags.Exportable);尝试{ServiceAccountCredentialcredential=newServiceAccountCredential(newServiceAccountCredential.Initializer("*******..com"){Scopes=scopes}.FromCertificate(certificate));//创建服务。DriveServiceservice=newDriveService(newBaseClientService.Initializer(){HttpClientInitializer=credential,ApplicationName="DaimtoDriveAPISample",});varfiles=service.Files.List().Execute().Files;varrequest=service.Files.Get(files.First().Id);varstream=newSystem.IO。内存流();request.MediaDownloader.ProgressChanged+=(IDownloadProgressprogress)=>{switch(progress.Status){案例DdownloadStatus.Downloading:{Console.WriteLine(progress.BytesDownloaded);休息;}caseDownloadStatus.Completed:{Console.WriteLine("下载完成。");休息;}caseDownloadStatus.Failed:{Console.WriteLine("下载失败。");休息;}}};请求。下载(流);本文收集自网络,不代表立场。如涉及侵权,请点击右侧联系管理员删除。如需转载请注明出处:
