【发布时间】:2012-09-21 11:51:20
【问题描述】:
我无法从该用户的管理员帐户访问域用户的数据...我尝试在下面的 url 下制作 google docs 域用户的存档: 'https://docs.google.com/feeds/[userName]/private/archive'
和这个 url 来获取域用户的联系方式: https://www.google.com/m8/feeds/contacts/[userName]/full"
但它不起作用...请给出一些建议或其他解决方案。
for contacts, code is :
function getContacts(user){
var scope = 'https://www.google.com/m8/feeds/';
//oAuth
user="user@yourdomain.com"
var fetchArgs = googleOAuth_('contacts', scope);
var url = scope +'contacts/'+ user+'/full?v=3&alt=json';
var urlFetch = UrlFetchApp.fetch(url, fetchArgs);
}
//--------------------------------------------------------------------------------------
//Google oAuth
//Used by getDocuments(user)
function googleOAuth_(name,scope) {
var oAuthConfig = UrlFetchApp.addOAuthService(name);
oAuthConfig.setRequestTokenUrl("https://www.google.com/accounts/OAuthGetRequestToken?scope="+scope);
oAuthConfig.setAuthorizationUrl("https://www.google.com/accounts/OAuthAuthorizeToken");
oAuthConfig.setAccessTokenUrl("https://www.google.com/accounts/OAuthGetAccessToken");
oAuthConfig.setConsumerKey(consumerKey);
oAuthConfig.setConsumerSecret(consumerSecret);
return {oAuthServiceName:name, oAuthUseToken:"always", method: "GET"};
}
【问题讨论】:
-
查看以下关于如何检索目录联系人的答案:webapps.stackexchange.com/a/35880/29140