Reputation: 1349
I am unable to access data of domain user from admin account of that user...I tried below url to make archive of domain user of google docs : 'https://docs.google.com/feeds/[userName]/private/archive'
and this url to fetch contact detail of domain user : https://www.google.com/m8/feeds/contacts/[userName]/full"
But its not working...Please give some suggestion or some another solution to do this.
for contacts, code is :
function getContacts(user){
var scope = 'https://www.google.com/m8/feeds/';
//oAuth
user="[email protected]"
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"};
}
Upvotes: 1
Views: 765
Reputation: 3732
I have written some code which uses Google Docs native API to access user's feeds. You may check it here. https://sites.google.com/site/appsscripttutorial/urlfetch-and-oauth/get-the-document-list-of-a-domain-user
The same concept can be extended to do other objectives which you have asked in your question
Upvotes: 1