Pages Menu

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

Learn Skype Web SDK Day 9 : Getting & Displaying Contact Photos

Learn Skype Web SDK Day 9 : Getting & Displaying Contact Photos

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 Skype for Business, people have photos associated with them, so that they can easily be identified. Often these are administered in Active Directory alongside other information such as job title, department etc.

In Skype for Web API these photos can be accessed. They are a property of the person object, which means they can get accessed with a get() comamnd. The property name is avatarURL. To get the value you would first get a handle to the person object (which can be yourself, or another contact) and then call get() on the property:

[code language=”javascript”]

person.avatarUrl.get().then(function(value) {
//do something with the photo


The return object isn’t the actual photo – it’s a URL describing the photo. For instance, you might get back this URL:[email protected]

This URL has been crafted together for us by Skype for Web API (well, actually UCWA but it doesn’t matter) and if you were to load that in a browser, you’d see the image.

This means that you can provide the URL as the source attribute to a HTTP image container you have created, or do something else with it in JavaScript etc. To set it as the source for an image you might do this:

[code language=”javascript”]



Here’s a full code sample which demonstrates these functions:

[code language=”javascript”]

Your Photo:


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).