首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >批量设置文件权限

问批量设置文件权限
EN

Stack Overflow用户
提问于 2017-06-03 02:48:51
回答 0查看 167关注 0票数 0

我输出以下错误,该错误是在对文件执行一批文件权限更改时生成的。我不确定这是怎么回事,因为这只是一些文件的问题,当试图在调试模式下运行时,这个问题不会触发:

代码语言:javascript
复制
500 >> Internal Error. User message: "An internal error has occurred which prevented the sharing of these item(s): Example File.DOCX"

我使用了以下代码:

代码语言:javascript
复制
var batch = new Google.Apis.Requests.BatchRequest(service);

Google.Apis.Requests.BatchRequest.OnResponse<Permission> callback = delegate (
            Permission permission,
            Google.Apis.Requests.RequestError error,
            int index,
            System.Net.Http.HttpResponseMessage message) {
                if (error != null) {
                    // Handle error
                    Console.WriteLine("File PERMISSION Error: " + error.Code + " >> " + error.Message);
                } else {
                    Console.WriteLine("File Permission ID: " + permission.Id);
                }
            };

Permission filePermission = new Permission()
{
    EmailAddress = "test-email@gmail.com"
    , Type = GoogleDriveRoleType
    , Role = GoogleDriveRole
};

var permExec = service.Permissions.Create(filePermission, googleDriveObjectId);
permExec.SendNotificationEmail = false;
permExec.Fields = "id";
batch.Queue(permExec, callback);

await batch.ExecuteAsync(); 

这段代码在一个public static async Task MyMethod(...)方法中。

EN

回答

页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/44335607

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档