2014-06-06 93 views

回答

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中使用;」在命名空間之上。

0

的LINQ版本的@Visual文森特代碼:

var users = cmd.Skype.CustomGroups.OfType<SKYPE4COMLib.Group>() 
    .Where(o => o.DisplayName == "GroupName") 
    .SelectMany(o => o.Users.OfType<SKYPE4COMLib.User>()); 
相關問題