Pages Menu
TwitterRssFacebook

Posted by on May 15, 2015 in Learn Skype Web SDK

Learn Skype Web SDK Day 12 : Getting Users in Groups

Learn Skype Web SDK Day 12 : Getting Users in Groups

[contemplate-1]
View Demo

In the last few lessons we’ve looked at how to get lists of contacts and groups. However, sometimes it’s the structuring of contacts within groups which is important, and which you want to display in your application.

Once you have retrieved a particular group or groups, you can then query that group for its members, using the property persons. This collection isn’t immediately filled however (for performance reasons) so you can subscribe items being added to it:

[code language=”javascript”]

group.persons.added(function (person) {
//do something with the person object
});

[/code]

It’s worth nothing that if you do this for all groups you may get the same person object returned multiple times – one for each group that the user is in.

In the code sample below, all groups and their users are collated and displayed on the screen. Notice how relatively slow this action is compared to some of the other functions in the Skype Web SDK. This is why the SDK is structured to only load the data you need when you ask for it.

[code language=”javascript”]


Group List:


    [/code]

    Demo Online

    You can try this code out against your own Skype for Business environment by going to the demo page. From here you can also download the code from GitHub if you want to host it locally, or take it and use it in your next project.
    [contemplate-2]

    Post a Reply

    Your email address will not be published. Required fields are marked *