Hi,
I am very new to GAE. I want to add a Google domain contact using Java
API.
I tried using following code, but its adding a new contact for the id
which I am passing as value of "xoauth_requestor_id" parameter, and
not a domain contact.
ContactEntry newContact = new ContactEntry();
newContact.setId(contactId);
newContact.setTitle(new PlainTextConstruct(name));
newContact.setContent(new PlainTextConstruct(notes));
Email primaryMail = new Email();
primaryMail.setAddress(emailId);
primaryMail.setPrimary(true);
newContact.addEmailAddress(primaryMail);
ExtendedProperty companyProperty = new ExtendedProperty();
companyPropery.setName("CONTACT-ID");
companyPropery.setValue(contactId);
newContact.addExtendedProperty(companyProperty);
GoogleOAuthParameters oauthParameters = new GoogleOAuthParameters();
oauthParameters.setScope(SCOPE);
oauthParameters.setOAuthConsumerKey(CONSUMER_KEY);
oauthParameters.setOAuthConsumerSecret(CONSUMER_SECRET);
String url = FEED_URL + "?xoauth_requestor_id=" + "[email protected]";
URL postUrl = new URL(url);
OAuthSigner signer = new OAuthHmacSha1Signer();
ContactsService myService = new ContactsService("ContactDemoApp");
myService.setOAuthCredentials(oauthParameters, signer);
ContactEntry createdContact =
myService.insert(postUrl,newContact);
Kindly let me know is there any way we can create domain contact using
API.
Thanks in advance.
Regards,
Nirzari
--
You received this message because you are subscribed to the Google
Groups "Google Contacts, Shared Contacts and User Profiles APIs" 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://code.google.com/apis/contacts/community/forum.html