Pages Menu
TwitterRssFacebook

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

Learn Skype Web SDK Day 12 : Getting Users in Groups

Learn Skype Web SDK Day 12 : Getting Users in Groups

This is one post in a series of more than 30, devoted to helping you get up to speed quickly with the new Skype Web SDK. Each lesson comes with source code (in GitHub) and a working demo page so you can see what it does. Check out the full list of posts on the Skype Web SDK page.


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.

    Disclaimer: This is sample code, intended to inform and educate. It is not production-ready and is lacking key components such as error handling. You use it entirely at your own risk. You should fully understand the effects, limitations and risks of the code before executing, and understand the implications of any set-up steps. By using these code examples you are using the Skype Web SDK, so you should read the Skype Software License Terms to which you are agreeing.

    Good to Know

    Post a Reply

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

    This site uses cookies to help make this website better. By continuing to use this site we’ll assume you’re OK with that (implied consent).