能够从 ContactEntry 中删除 GroupMembershipInfo,但无法添加 GroupMembershipInfo
更新现有 ContactEntry 以将 GroupMembershipInfo 包含在现有 ContactGroupEntry 中的正确方法是什么?
我正在使用 Java API com.google.gdata.data.contacts...
// groupNameId was fetched with ContactGroupEntry.getId()
// entry is a known-good ContactEntry
// contactsService is a properly authenticated feed
GroupMembershipInfo g = new GroupMembershipInfo();
g.setHref(groupNameId);
entry.addGroupMembershipInfo(g);
contactsService.update(new URL(entry.getEditLink().getHref()), entry);
// .... fails with PreconditionFailedException
我能够成功检索联系人并删除群组成员身份,但添加群组成员身份却让我困惑,而且我一直无法找出正确的 Google 搜索来找到一段有用的示例代码
What is the proper way to update an existing ContactEntry to include GroupMembershipInfo in an existing ContactGroupEntry?
I am using the Java APIs com.google.gdata.data.contacts...
// groupNameId was fetched with ContactGroupEntry.getId()
// entry is a known-good ContactEntry
// contactsService is a properly authenticated feed
GroupMembershipInfo g = new GroupMembershipInfo();
g.setHref(groupNameId);
entry.addGroupMembershipInfo(g);
contactsService.update(new URL(entry.getEditLink().getHref()), entry);
// .... fails with PreconditionFailedException
I am able to successfully retrieve contacts and remove group membership, but adding group membership is eluding me, and I have been unable to figure out the right Google search to find a useful piece of sample code
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
GroupEntry 被添加到 GroupMembership,而 GroupMembership 又被添加到 ContactEntry
entry.getGroupMembershipInfos().add(g);
GroupEntry is added to the GroupMembership which is added to the ContactEntry
entry.getGroupMembershipInfos().add(g);