Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/299.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# 使用google drive API V3复制google drive文件时出错_C#_Google Drive Api - Fatal编程技术网

C# 使用google drive API V3复制google drive文件时出错

C# 使用google drive API V3复制google drive文件时出错,c#,google-drive-api,C#,Google Drive Api,我正在尝试使用Google Drive API V3复制Google Drive文件 这是我用c#复制谷歌硬盘文件的代码。我可以复制一些文件,但对于某些文件,我无法复制 public Google.Apis.Drive.v3.Data.File copyDriveFiles(Google.Apis.Drive.v3.Data.File file) { string strFileId = file.Id; //new file G

我正在尝试使用Google Drive API V3复制Google Drive文件

这是我用c#复制谷歌硬盘文件的代码。我可以复制一些文件,但对于某些文件,我无法复制

    public Google.Apis.Drive.v3.Data.File copyDriveFiles(Google.Apis.Drive.v3.Data.File file)
    {
        string strFileId = file.Id;
        //new file
        Google.Apis.Drive.v3.Data.File copyFile = new Google.Apis.Drive.v3.Data.File();
        copyFile.Name = file.Name;
        
        try
        {
            //copy request
            Google.Apis.Drive.v3.FilesResource.CopyRequest copyRequest = service.Files.Copy(copyFile, strFileId);
            copyRequest.SupportsAllDrives = true;
            copyFile = copyRequest.Execute();

            return copyFile;
        }
        catch (GoogleApiException ge)
        {
            throw ge;
        }
    }
不幸的是,我得到了一些文件的内部错误,如下所示

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "internalError",
    "message": "Internal Error"
   }
  ],
  "code": 500,
  "message": "Internal Error"
 }
}

如果有人能解释这个错误的原因和解决方法,我将不胜感激。

欢迎来到stack,请编辑您的问题并包含您的代码。内部错误其实并不多,这是谷歌方面的错误。请分享您的代码和请求,谢谢您的评论。我用上传代码编辑了我的问题,以复制google驱动器文件。@TsheringChax获取的文件类型是什么?重试是否总是返回此错误?文件是否可以从驱动器用户界面查看/打开?谢谢@RafaGuillermo,现在,我从CSV文件[MIME Type=“text/CSV”]中得到此错误。但我已经检查了其他CSV文件,它成功了。是的,我也尝试了重试方法,但复制失败。来回答你的最后一个问题。是的,我可以从驱动器用户界面查看文件。欢迎使用stack。请编辑您的问题并包含您的代码。内部错误并不多,这是谷歌方面的错误。请分享您的代码和请求,谢谢您的评论。我用上传代码编辑了我的问题,以复制google驱动器文件。@TsheringChax获取的文件类型是什么?重试是否总是返回此错误?文件是否可以从驱动器用户界面查看/打开?谢谢@RafaGuillermo,现在,我从CSV文件[MIME Type=“text/CSV”]中得到此错误。但我已经检查了其他CSV文件,它成功了。是的,我也尝试了重试方法,但复制失败。来回答你的最后一个问题。是的,我可以从驱动器UI查看文件。