Finally, I could communicate at least with contacts service.

I forgot to note that my computer has Win 7 with locale "es-AR" (but
other settings currently in English).

- First thing to do: set current culture (because I've read in a post
that months swap with days, and comma decimal separator will make
trouble).
- Remember: I have to access domain 2 contacts with domain 1 secret (I
currently set permission in domain admin to do that).
- OAuthUri constructor: must be set to domain 2 admin email address
(not done before) --> Check it in code.

- As a suggestion for everybody: the response objects has more
detailed error message than the exception itself. InnerExcepcion is
worthless too, simply check the html in the response object. That was
the key to solve this problem by myself. The full 401 error code was:
                         - Unknown header (solved setting culture to
en-US)
                         - Cannot access contact from other domain
(solved setting OAuthUri constructor as stated before).


Perhaps this might help other people stuck like me...

Now: I have to solve why is getting me only 25 shared contacts despite
the fact I have ~1300 already...

            try
            {
                System.Threading.Thread.CurrentThread.CurrentCulture =
System.Globalization.CultureInfo.CreateSpecificCulture("en-US");

                // Create an OAuth factory to use
                String AppName = "yourappname";

                GOAuthRequestFactory requestFactory = new
GOAuthRequestFactory("cp", AppName);
                requestFactory.ConsumerKey = "domain1";
                requestFactory.ConsumerSecret = "domain1's secret";

                ContactsService cs = new ContactsService(AppName);
                cs.RequestFactory = requestFactory;

                ContactsQuery cq = new ContactsQuery();
                //Place domain 2 admin email in constructor:
user@domain2 --> This is mandatory for accessing contacts in other
domains.
                cq.Uri = new OAuthUri("https://www.google.com/m8/feeds/
contacts/domain2/full", "user", "domain2");


                //voilĂ : this line of code executes perfectly now.
                ContactsFeed cf = cs.Query(cq);

                Console.WriteLine("Shared Contacts: " +
cf.Entries.Count);

                foreach (ContactEntry ce in cf.Entries)
                {
                    Console.WriteLine(ce.EditUri);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-appengine?hl=en.

Reply via email to