tags:

views:

72

answers:

1

Hi,

I want to add "Nickname" in Google Contact using "Google.GData.Extensions.Apps" .

I am able to create Nickname as:

NicknameElement obj_nickname = new NicknameElement(); obj_nickname.Name = " Jenifer";

But how to add i to Contact Entry?

A: 

Hi Jene,

The Contacts API does support nicknames using the gContact:nickname element. This element is new in version 3.0 of the Contacts API, and as such is in the gContact namespace. For example:

<atom:entry xmlns:atom='http://www.w3.org/2005/Atom'
    xmlns:gd='http://schemas.google.com/g/2005'&gt;
  <atom:category scheme='http://schemas.google.com/g/2005#kind'
      term='http://schemas.google.com/contact/2008#contact' />
  <gd:name>
    <gd:givenName>Victor</gd:givenName>
    <gd:familyName>Fryzel</gd:familyName>
    <gd:fullName>Vic Fryzel</gd:fullName>
  </gd:name>

  <!-- ... -->

  <gContact:nickname>Vic</gContact:nickname>
</atom:entry>

Fortunately, the .NET client library has been updated with a getter and setter for this parameter, although the methods are undocumented in the .NET Developer's Guide. But, you can find them in the source code.They're in the source code here:

Thus, you can use the following code to set a contact's nickname.

Contact newContact = new Contact();
newContact.Title.Text = "Victor Fryzel";
newContact.Nickname = new Nickname("Vic");
// ...
// This example assumes the ContactRequest object (cr) is already set up.
Contact createdContact = cr.Insert(newContact);

For more information, please see the .NET Developer's Guide. Good luck!

vicfryzel