Hi there,
currently I'm working on an app, adding and updateting a contact via google contacts api.
It works so far, but I'm having an issue at the update procedure..
My workflow is this:
Get the specific contact, edit/add some properties, and update it to google..
But when I try to add a new email address to the contact, I get a "The remote server returned an error: (400) Bad Request." Error back. Inner Exception is null.
ContactsRequest cr = new ContactsRequest(new RequestSettings(CStr.Caption, new GDataCredentials(Username, Password)));
Contact newEntry = new Contact();
Contact contact = cr.Retrieve<Contact>(new Uri(GoogleTargetId));
foreach(CollisionField field in list)
{
switch(field.collisionField)
{
case CollisionFieldEnum.Mail:
if (field.Sync)
{
try
{
EMail e = contact.Emails.FirstOrDefault(
x => x.Value == GoogleOrig.Mail);
if (e != null)
e.Value = SourceContact.Mail;
else
{
e = new EMail()
{
Primary = true,
Value = SourceContact.Mail,
Rel = ContactsRelationships.IsHome
};
contact.Emails.Add(e);
}
field.Synced = true;
}
catch(Exception ex)
{
CMisc.AttachToLog("Cannot update Google Contact field: " + field.collisionField.ToString() + "; " + ex.ToString());
field.Synced = false;
}
}
break;
default:
break;
so far no problems...
I get the exception right here, when I want so submit the changes:
Contact updatedC = cr.Update(contact);
I only have this problem when adding a new email address to the contact. Phone, Address, etc works all perfectly.. but not the mail.
Now I don't have any clues how to resolve this problem.
May be someone could help me please with this issue.
If you need some more informations, just let me know and I'll post it.
Thanks in advance..