使用 URLFetchApp 从文档 ACL 中删除用户的共享权限...
下面是我的代码
function removeSharing(docId,userToRemove)
{
var base = 'https://docs.google.com/feeds/default/';
var fetchArgs = googleOAuthDeleteUser_('docs', base);
var url = base+'private/full/'+docId+'/acl/'+encodeURIComponent(userToRemove);
var content = UrlFetchApp.fetch(url, fetchArgs).getContentText();
return 'ok';
}
function googleOAuthDeleteUser_(name,scope) {
var oAuthConfig = UrlFetchApp.addOAuthService(name);
oAuthConfig.setRequestTokenUrl("https://www.google.com/accounts/OAuthGetRequestToken?scope="+encodeURIComponent(scope));
oAuthConfig.setAuthorizationUrl("https://www.google.com/accounts/OAuthAuthorizeToken");
oAuthConfig.setAccessTokenUrl("https://www.google.com/accounts/OAuthGetAccessToken");
oAuthConfig.setConsumerKey("anonymous");
oAuthConfig.setConsumerSecret("anonymous");
return {
oAuthServiceName:name,
oAuthUseToken:"always",
headers : {
"GData-Version": "3.0",
"If-Match":"*"
},
method : "DELETE",
contentType : 'application/x-www-form-urlencoded'
};
}
它给了我错误
请求返回代码 400 失败。服务器响应:GData
InvalidEntryException
发布的条目缺少一个或多个必填字段:范围
请帮忙解决这个问题。