Bridge Communications

Saturday, April 8, 2017

Skype Web SDK - Part II

What is the Skype Web SDK?

The Skype Developer Platform for Web ("Skype Web SDK") is a set of JavaScript Web APIs and HTML controls that enable you to build web experiences that seamlessly integrate a wide variety of real-time collaboration models leveraging Skype for Business services and the larger Skype network. It provides support for multiple core collaboration services like presence, chat, audio, and video, enabling web experiences across a broad spectrum of users, platforms, and devices.

Today's Topic: The Local User Object

As you could probably guess, the local user object or MePerson is the object you can use to set and read information about the current user who is signed in.  This is accessed via the application.personsAndGroupsManager.mePerson property.  Here is some sample code we could use to set ourselves to the Skype for Business Available status.

// tell the mePerson to change the availability state app.personsAndGroupsManager.mePerson.status.set('Online').then(function () { alert('The status of mePerson has been changed'); }).then(null, function (error) { // and if could not be changed, report the failure alert(error || 'The server has rejected this availability state.'); });

Properties you can set

The MePerson object has a few properties we can set. In the code above we changed the Status property. It's important to note, that UCWA can set that Availability 1/2 of the user status, but not the Activity 1/2. The Activity piece is read only in UCWA unlike UCMA and the Client SDK.

The Location property is something S4B users can set in mostly clients, and UCWA is no different. You can set this as text to anything you want, a city, a room, a floor, a planet, etc.

This is the property that can be used to change the user's default note.

One thing to be aware of is special characters.  Since this all distills down to HTML in the end, I would caution you from trying to put < > type characters in any of these string values, as you will most likely see some very weird results.

Properties you cannot set

Below are some of the MePerson properties you can read but not change.

departmentGets the work department of the signed in user.
emailGets the primary email address of the signed in user.
emailsGets the email addresses associated with the signed in user.
displayNameGets the display name of the signed in user.
avatarUrlGets the photo URL of the signed in user.
titleGets the business title of the signed in user.
idGets the SIP URI of the signed in user.

// retrieve local user details const mePerson = app.personsAndGroupsManager.mePerson; photo.src = mePerson.avatarUrl(); window.setTimeout(function (photo: HTMLImageElement) { // if the photo isn't set revert back to a default if (photo.naturalWidth === 0 || photo.naturalHeight === 0) { photo.src = './images/samples/default.png'; } }, 1000, photo); name.innerHTML = mePerson.displayName(); status.src = getStatusPath(mePerson.status()); message.innerHTML = mePerson.note.text(); location.innerHTML = mePerson.location();

Next week we'll begin to dive into conversations, and how you can handle those.

Doug Routledge, C# Lync, Skype for Business, SQL, Exchange, UC, 
Full Stack Developer  BridgeOC Bridge Operator Console
Twitter - @droutledge @ndbridge

No comments:

Post a Comment