我的应用/帐户已失去更新原生Google文档文件的权限

时间:2014-05-08 22:56:18

标签: c# google-drive-api google-oauth

截至今天下午我无法再更新谷歌文档文件,同事也看到了这个问题,但是还有两个人看到它工作正常,我们都运行相同的版本。

在今天下午之前没有人遇到过这样的麻烦,这是我申请权限的地方:

GoogleWebAuthorizationBroker.Folder = "Tasks.Auth.Store";
StoredCredential = GoogleWebAuthorizationBroker.AuthorizeAsync(
    GoogleClientSecrets.Load(stream).Secrets,
    new[] { DriveService.Scope.Drive,
            DriveService.Scope.DriveFile },
    "user",
    CancellationToken.None,
    new SavedDataStore()).Result;

我知道进入更新的fileID是这样的:

request = service.Files.Get(fileID);
myFile = request.Execute();

在使用Google文档时,我将其下载为docx文件,因此:

if (myFile.MimeType == "application/vnd.google-apps.document")
    myFile.MimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";

这是更新发生的地方:

try
{
    //fileLoc contains the updated contents
    byte[] byteArray = System.IO.File.ReadAllBytes(fileLoc);
    System.IO.MemoryStream stream = new System.IO.MemoryStream(byteArray);
    FilesResource.UpdateMediaUpload updateRequest = service.Files.Update(myFile, fileID, stream, myFile.MimeType);
    //fileID is used to get myFile in the first place; myFile is = to myFile.Id
    updateRequest.Upload();
}
catch (Exception e)
{
    MessageBox.Show("An error occurred: " + e.Message);
}

此请求在不丢失任何错误的情况下发生,甚至更新这些文件的时间戳,但内容不会更新。我想失去理智,想知道出了什么问题。

有谁知道如何解决这个问题?我觉得我没有线索继续下去。

1 个答案:

答案 0 :(得分:1)

暂时出现故障,现在应该再次工作了。