1

我是 Google 联系人的 Google API 的初学者。我已经实现了列出所有联系人并添加新联系人。我现在在更新\编辑和删除联系人时遇到问题。我尝试了许多网络示例,但均未成功。你能帮助我吗?

 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.dll 中出现“Google.GData.Client.GDataRequestException”类型的未处理异常

附加信息:请求执行失败:

4

0 回答 0