C# 媒体类型'';不支持。有效的媒体类型:[*/*]

C# 媒体类型'';不支持。有效的媒体类型:[*/*],c#,C#,将图像插入到我的Google-drive帐户时出错,请查看代码“媒体类型“”不受支持。有效的媒体类型:[/]” private static Google.api.Drive.v2.Data.File insertFile(DriveService服务、字符串标题、字符串描述、字符串parentId、字符串mimeType、字符串文件名) { //文件的元数据。 Google.api.Drive.v2.Data.File body=新的Google.api.Drive.v2.Data.File(

将图像插入到我的Google-drive帐户时出错,请查看代码“媒体类型“”不受支持。有效的媒体类型:[/]”

private static Google.api.Drive.v2.Data.File insertFile(DriveService服务、字符串标题、字符串描述、字符串parentId、字符串mimeType、字符串文件名)
{
//文件的元数据。
Google.api.Drive.v2.Data.File body=新的Google.api.Drive.v2.Data.File();
body.Title=“Bluehills.jpg”;
body.Description=“你好”;
body.MimeType=“application/vnd.google apps.drive sdk”;
//var googleFile=new google.google.api.Drive.v2.Data.File();
//设置父文件夹。
如果(!String.IsNullOrEmpty(parentId))
{
body.Parents=new List(){new ParentReference(){Id=parentId}};
}
//文件的内容。
byte[]byteArray=System.IO.File.ReadAllBytes(文件名);
MemoryStream stream=新的MemoryStream(byteArray);
尝试
{
fileresource.InsertMediaUpload请求=service.Files.Insert(body、stream、mimeType);
request.Upload();
Google.api.Drive.v2.Data.File File=request.ResponseBody;
//取消注释以下行以打印文件ID。
//Console.WriteLine(“文件ID:+File.ID”);
返回文件;
}
捕获(例外e)
{
Console.WriteLine(“发生错误:+e.Message”);
返回null;
}
}
“application/vnd.google apps.drive sdk”用于创建快捷方式

尝试使用其他mime类型。比如:图像/jpeg

使用body.MimeType=“image/jpeg”查看;正在发送相同的错误消息
private static Google.Apis.Drive.v2.Data.File insertFile(DriveService service, String title,  String description, String parentId, String mimeType, String filename)
{
    // File's metadata.
    Google.Apis.Drive.v2.Data.File body = new Google.Apis.Drive.v2.Data.File();
    body.Title = "Bluehills.jpg";
    body.Description = "hello";
    body.MimeType = "application/vnd.google-apps.drive-sdk";
    //var googleFile = new google.Google.Apis.Drive.v2.Data.File();

    // Set the parent folder.
    if (!String.IsNullOrEmpty(parentId))
    {
        body.Parents = new List<ParentReference>() { new ParentReference() { Id = parentId } };
    }

    // File's content.
    byte[] byteArray = System.IO.File.ReadAllBytes(filename);
    MemoryStream stream = new MemoryStream(byteArray);

    try
    {
        FilesResource.InsertMediaUpload request = service.Files.Insert(body, stream, mimeType);
        request.Upload();

        Google.Apis.Drive.v2.Data.File file = request.ResponseBody;

        // Uncomment the following line to print the File ID.
        // Console.WriteLine("File ID: " + file.Id);

        return file;
    }
    catch (Exception e)
    {
        Console.WriteLine("An error occurred: " + e.Message);
        return null;
    }
}