我知道我可以通过Skype.Friends
与我联系。但是,我想只获取特定联系人列表中的联系人。
我该怎么做?
答案 0 :(得分:1)
试试这个:
private void button1_Click(object sender, EventArgs e)
{
ArrayList UserList = new ArrayList();
var SkypeClient = new SKYPE4COMLib.Skype();
foreach(SKYPE4COMLib.Group Group in SkypeClient.CustomGroups)
{
if (Group.DisplayName == "<specify the usergroup name here>")
{
foreach (SKYPE4COMLib.User User in Group.Users)
{
//Adds the usernames from the specified group in the list.
UserList.Add(User.Handle);
}
}
}
//Writing the list in a label
string s = "";
foreach(string str in UserList)
{
s = s + str + Environment.NewLine;
}
label1.Text = s;
}
哦,并使用System.Collections写&#34;&#34;在命名空间之上。
答案 1 :(得分:0)
Linq版@Visual Vincent的代码:
var users = cmd.Skype.CustomGroups.OfType<SKYPE4COMLib.Group>()
.Where(o => o.DisplayName == "GroupName")
.SelectMany(o => o.Users.OfType<SKYPE4COMLib.User>());