1
删除共享许可使用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
发布条目缺少一个或多个必填字段: scop e
请帮忙整理一下。