Trying to retrieve a single contact. In the link, it says:
public static Contact retrieveContact(ContactsRequest cr)
{
Contact contact = cr.Retrieve<Contact>("https://www.google.com/m8/feeds/contacts/default/full/contactId");
return contact;
}
How would one know what's the contact's selflink URL, or even the contactId? I tried different variations:
https://www.google.com/m8/feeds/contacts/default/full/firstname.lastname https://www.google.com/m8/feeds/contacts/ourdomain.com/full/firstname.lastname https://www.google.com/m8/feeds/contacts/firstname.lastname%40ourdomain.com/full/firstname.lastname
But I can't seem to get a proper return value. All I am getting is Not Found exception.
Full error message is:
{"The remote server returned an error: (404) Not Found."}
I am able to connect to the service, as I am able to do a proper query if I retrieve all contacts. But getting a bit stumped on retrieving a single contact.
Anyone already worked on this?
Appreciate any advice.
Update: If for example you use the ContactsQuery such as:
ContactsQuery query =
new ContactsQuery("https://www.google.com/m8/feeds/profiles/domain/" + this.domain + "/full");
query.Query = ?????
What can we specify in the query object so that we can actually just go retrieve one user (based on user name or email address)?
Update: I used GAM (https://code.google.com/p/google-apps-manager/) to retrieve a particular user and there was an ID field there composed of a bunch of numbers. I tried to use that in lieu of the ContactID field in the URI as above, but all variations just returns a 403 Not Found error.
You need to know the contactId
ahead of time. It is not possible to look up a Contact record from their email address with the Contacts API.
If you are just looking for users in your domain, then check out the Directory API - https://developers.google.com/admin-sdk/directory/v1/guides/manage-users#get_user