1

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"};
    }
1

1 Answer 1

1

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

3
  • I tried this concept for fetching the contacts of user also but it gives error. Request failed for returned code 403.
    – Rishi
    Sep 24, 2012 at 10:58
  • @Rishi, You are right. I followed the same approach but it is not working for contacts. I tried at oAuth2.0 Playground (developers.google.com/oauthplayground). It works for docs but not for Contacts. I am not sure why. You may post it to Google Contacts API forum. Sep 24, 2012 at 17:58
  • Any advances on this, is there an issue open for it? I just tried @Rishi 's script but it does not seem to work still.
    – Jacobvdb
    Apr 8, 2014 at 1:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.