C# NET中的Google联系人API
我是谷歌联系人谷歌API的初学者。我已实现列出所有联系人并添加新联系人。我现在在更新\编辑和删除联系人时遇到问题。我尝试了许多网络示例,但都没有成功。你能帮我吗C# NET中的Google联系人API,c#,google-api,google-contacts-api,C#,Google Api,Google Contacts Api,我是谷歌联系人谷歌API的初学者。我已实现列出所有联系人并添加新联系人。我现在在更新\编辑和删除联系人时遇到问题。我尝试了许多网络示例,但都没有成功。你能帮我吗 public static void EditContact(string id, string name, StructuredPostalAddress address) { ContactsQuery query = new ContactsQuery(ContactsQuery.CreateContactsUri("
public static void EditContact(string id, string name, StructuredPostalAddress address)
{
ContactsQuery query = new ContactsQuery(ContactsQuery.CreateContactsUri("default"));
ContactsFeed feed = GContactService.Query(query);
foreach (ContactEntry entry in feed.Entries)
{
foreach (EMail email in entry.Emails)
{
if (email.Address == id)
{
Organization org = new Organization();
org.Rel = ContactsRelationships.IsWork;
org.Title = "President, CEO";
org.Name = "John Doe Enterprises";
org.Primary = true;
entry.Name = new Name() { FullName = name };
entry.PostalAddresses.Add(address);
entry.Organizations.Add(org);
// error:
// Execution of request failed
ContactEntry updatedEntry = (ContactEntry)entry.Update();
}
}
}
}
类型的未处理异常
“Google.GData.Client.GDataRequestException”发生在中
Google.GData.Client.dll
其他信息:请求执行失败:
是的,您试图使用
entry
变量,但是没有这样的变量。你以为这会怎么样?您要更新的条目是什么?您是否将条目保存在列表中的某个地方或其他地方?是否有完整源代码示例的最终解决方案?