5

Recent news says that Skype For Business is eventually going to be taken down and replaced by Microsoft Teams.

I have a few projects that rely on Skype For Business and I use the following code to update a user's presence on Skype For Business using the 2013 lync SDK.

public static void PublishPresence(ContactAvailability contactAvailability)
{
    var publishData = new Dictionary<PublishableContactInformationType, object>
    {
        {PublishableContactInformationType.Availability, contactAvailability}
    };

        SendPublishRequest(publishData);
}

private static void SendPublishRequest(Dictionary<PublishableContactInformationType, object> publishData)
{
    try
    {
        PublishContactInformation(publishData);
    }
    catch (Exception exception)
    {
        _logger.Error("Cannot publish presence to Lync. Error: " + exception);
    }
}

public static void PublishContactInformation(Dictionary<PublishableContactInformationType, object> publishData)
{
    LyncClient lyncClient = LyncClient.GetClient();

    lyncClient.Self.BeginPublishContactInformation(publishData, ar => lyncClient.Self.EndPublishContactInformation(ar), null);
}

With that said we do plan on moving our projects to Microsoft Teams. However, we looked at the current Microsoft Teams SDK and we could not find any information about updating a user's presence.

Is something similar not listed on their documentation that allows myself to change my own status/presence?

Rafael
  • 727
  • 13
  • 30
  • 1
    If I change my availability status in the web interface of Teams, a request is posted to `https://emea-client-ss.msg.skype.com/v1/users/ME/presenceDocs/messagingService`. The JSON posted has a `type` property with value `UserPresenceDoc`. The `skype` in there is not a typo; it seems the current Teams infrastructure simply piggybacks off Skype. (It may or may not continue to do so, or continue to maintain endpoints for compatibility.) – Jeroen Mostert Oct 06 '17 at 14:52
  • So it's a REST call... hmm. Would you be able to lead me to any documentation about that request? – Rafael Oct 06 '17 at 14:55
  • Beyond what you can google with keywords like `presenceDocs` and `messagingService`, no. I have no idea how either Skype *or* Teams work, I simply used the debugging feature in my browser to spy on the network request. You can easily do the same. (Well, assuming you have Teams, of course.) – Jeroen Mostert Oct 06 '17 at 14:56
  • My account doesn't have Teams enabled yet, but I will play around with it more when my admin enables it. – Rafael Oct 06 '17 at 15:01
  • 1
    If you have an MSDN/Visual Studio subscription, you have access to a Developer Tenant. This allows you to spin up full O365 development environment with all the bells and whistles (including Teams). – Marc LaFleur Oct 06 '17 at 15:04
  • FYI: your link to the Teams SDK is dead. Can you update? – Frank Lesniak Apr 23 '20 at 13:43

2 Answers2

5

I'm happy to help with the API's that exist in Production or Preview today but Stack Overflow isn't the right platform for long-term roadmap discussions. That is something best left to official channels to disclose when it's ready.

At the moment, you're correct in that the Microsoft Teams SDK doesn't include APIs for interacting with Presence. This is because Teams itself is mirroring Skype's presence using Skype's API. You can replicate this functionality within your application using the similar APIs.

A good place to start would be the Unified Communications Web API (UCWA). If you're simply looking to surface Presence (rather than manipulate it), you can retrieve contactPresence. For manipulating the current user's status, you can use presence.

Marc LaFleur
  • 31,987
  • 4
  • 37
  • 63
  • You're the man, Marc! I will read up on it. I am looking to manipulate my own presence on Teams. Is there any word on upcoming features for the Teams SDK? It would be nice to have more power over the user's client. For example in Skype For Business we were able to add context menus when right clicking a contact, pulling up information from users, etc. – Rafael Oct 06 '17 at 15:43
  • Given what you said in the first paragraph, you can disregard everything on my first comment after the 3rd sentence. – Rafael Oct 06 '17 at 15:45
  • @Marc LaFleur - MSFT UCWA needs user's credentials. Entirely different scenario for an application with UCMA like capabilities. The question is if there is a roadmap for such features or the road is closed? – stefan2410 Oct 07 '17 at 15:12
  • There is a roadmap for these features but that may not mean they end up in the Teams API. Using Outlook as an example (similar Client/Server separation of concerns among APIs), there are two APIs available: Add-ins and Graph. Some functionality lives in the Add-in API, others live in the Graph API. You avoid the need for duplicating credentials by the Add-in API providing an access token for Graph API. – Marc LaFleur Oct 07 '17 at 18:11
  • To add some color to @ma – Bill Bliss - MSFT Oct 09 '17 at 23:09
4

To add some color to @MarcLaFleur-MSFT's answer...

All the calling/video/meeting functionality in Teams use Office-365 compliant instances of the Skype Consumer technology. It is a REST api, as @jeroen-mostert noticed, but it's not meant to be used by external developers. Besides the fact that it's not documented or supported, these endpoints require a special kind of access token.

The roadmap for Teams APIs definitely includes presence. But the API will be part of the Microsoft Graph API, not what you observe using Fiddler or the browser debugger today.

Bill Bliss - MSFT
  • 3,553
  • 1
  • 14
  • 17