Pages Menu

Posted by on May 5, 2015 in Learn Skype Web SDK | 2 comments

Learn Skype Web SDK Day 3 : Getting Your Own Presence

Learn Skype Web SDK Day 3 : Getting Your Own Presence

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

Once you’ve logged in, you can start to access information about users, including yourself.

Skype for Web API makes it easy to get at your own information, with the mePerson object. You can access this from the Application object, once you’re signed in.

From the mePerson object, the state object gives you your current presence state (but this isn’t the best way, see below).

[code language=”javascript”]

var client = = new Skype.Web.Model.Application;
// do sign-in process here
var presenceState = client.personsAndGroupsManager.mePerson.status;


The return object is a Status Property, with a value which represents the presence state. Valid presence states (that I’ve found) are:

  • Online
  • Busy
  • DoNotDisturb
  • BeRightBack
  • Away

However, just getting the state by referencing the property isn’t the best, because there’s no guarantee that the property will be populated. If you read the property really soon after logging in, you may find that it’s null, because it’s not been filled in yet by the server.

That’s why, for all properties, you should always register a changed listener for properties. That way, your code will never end up with a null value, it will wait (asynchronously, nicely) until the property is ready, then carry on.

A better way of doing the above would be:

[code language=”javascript”]

var client;
// do sign-in process here to instantiate the client object
client.personsAndGroupsManager.mePerson.status.get().then(function (presenceState ) {
// do something with the presence value

A more robust way of getting the presence is to set up an event from when it changes. This will be covered in the next post.

[code language=”javascript”]


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


  1. If Skype for business is already running in our server, do we need to set the cswebserviceconfiguration to allow it into a trusted domain to try out the example?

  2. your example are very nice and looks simple
    but when I input real working account ( username and pwd) of SkypeForBusiness

    javascript return me this:
    The requested resource does not support http method ‘GET’.

    i have tested in different variants – no result

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