gpt4 book ai didi

c# - 将联系人添加到特定组?谷歌联系API

转载 作者:太空宇宙 更新时间:2023-11-03 11:49:40 27 4
gpt4 key购买 nike

我正在使用 Google Contact API 将联系人和群组添加到 Google Apps (gmail) 中。我能够创建联系人和群组。

但现在我想:

  1. 在创建联系人时将联系人放入特定组。

最佳答案

/* Get Group, this is covered in the Google Contact API documents */
/* http://code.google.com/apis/contacts/docs/2.0/developers_guide_dotnet.html#retrieving_single_group */

Group group = ...;

Contact newContact = new Contact();

var groupMembership = new GroupMembership();
groupMembership.HRef= group.Id;


newContact.Title = "My google contact title";
newContact.GroupMembership.Add(groupMembership);

/* Save the contact, also covered in the documents */
/* http://code.google.com/apis/contacts/docs/2.0/developers_guide_dotnet.html#Creating */

关于c# - 将联系人添加到特定组?谷歌联系API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2415313/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com