Using same code as in Documentation of API v3.0 to create New Contact in 
Google Contacts returns 400 bad request Error code is below
Please help

public static Contact CreateContact(ContactsRequest cr)
{
  Contact newEntry = new Contact();

  newEntry.Name = new Name()
      {
        FullName = "Elizabeth Bennet",
        GivenName = "Elizabeth",
        FamilyName = "Bennet",
      };
  newEntry.Content = "Notes";

  newEntry.Emails.Add(new EMail()
      {
        Primary = true,
        Rel = ContactsRelationships.IsHome,
        Value = "[email protected]"
      });
  newEntry.Emails.Add(new EMail()
      {
        Rel = ContactsRelationships.IsWork,
        Value = "[email protected]"
      });

  newEntry.Phonenumbers.Add(new PhoneNumber()
      {
        Primary = true,
        Rel = ContactsRelationships.IsWork,
        Value = "(206)555-1212",
      });
  newEntry.Phonenumbers.Add(new PhoneNumber()
      {
        Rel = ContactsRelationships.IsHome,
        Value = "(206)555-1213",
      });

  newEntry.IMs.Add(new IMAddress()
      {
        Primary = true,
        Rel = ContactsRelationships.IsHome,
        Protocol = ContactsProtocols.IsGoogleTalk,
      });

  newEntry.PostalAddresses.Add(new StructuredPostalAddress()
      {
        Rel = ContactsRelationships.IsWork,
        Primary = true,
        Street = "1600 Amphitheatre Pkwy",
        City ="Mountain View",
        Region = "CA",
        Postcode = "94043",
        Country = "United States",
        FormattedAddress = "1600 Amphitheatre Pkwy Mountain View",
      });

  Uri feedUri = new Uri(ContactsQuery.CreateContactsUri("default"));
  Contact createdEntry = cr.Insert(feedUri, newEntry);
  Console.WriteLine("Contact's ID: " + createdEntry.Id)
  return createdEntry;
}


-- 
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

Reply via email to