我无法从该用户的管理员帐户访问域用户的数据......我尝试在下面的 url 下制作谷歌文档的域用户的存档:'https://docs.google.com/feeds/[userName]/private /档案'
和这个 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"};
}