Display the user presence/status using Skype web SDK or UCWA in UWP app

一个人想着一个人 提交于 2019-12-12 03:10:06

问题


I am having a requirement on just want to show/display the Skype for business user presence(Busy, Available, Off Work etc) in UWP app.

I have gone through the following documentations,

Skype Web SDK

I found that using Skype Web SDK we can show that but I am getting struck how can I use the Skype Web SDK in UWP app.

Can anyone know how can I use the Skype Web SDK in UWP app? or If have any other way to get skype user presence please help me out.

I also tried to use UCWA 2.0 , but got struck to get application uris


回答1:


I have found answer for my question after reading the following posts

A Sample Console Application (C# based)

Understanding the flow and How to get Application URLs

Stack Overflow

To get User Presence I added onemore method to the UcwaPresence like below: (You will find the UcwaPresence helper class in above mentioned sample app)

You have a GetPresenceURL method in UcwaPresence helper class with the help of that you can get the ucwaPresenceRootUri.

Once you get the GetPresence URL(here in my case called ucwaPresenceRootUri) then call the following method to get status

public static async Task<string> GetPresence(HttpClient httpClient, AuthenticationResult ucwaAuthenticationResult, String ucwaPresenceRootUri)
    {
        httpClient.DefaultRequestHeaders.Clear();
        httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", ucwaAuthenticationResult.AccessToken);
        httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

        var httpResponseMessage =
            httpClient.GetAsync(ucwaPresenceRootUri).Result;
        var presenceJsonStr = await httpResponseMessage.Content.ReadAsStringAsync();
        var presenceObj = JsonConvert.DeserializeObject<UcwaPresenceObject>(presenceJsonStr);
        Debug.WriteLine(presenceJsonStr);
        return presenceObj.availability;
    }

Credits

tam-huynh




回答2:


If you are using Javascript imlementation for building UWP apps, you can make use of Skype Web SDK. You just need to include the Skype Web SDK in your app and then you can directly use the methods from your app. You can refer this http://blog.thoughtstuff.co.uk/2016/03/skype-web-sdk-online-setting-everything-up-step-by-step-guide/



来源:https://stackoverflow.com/questions/39384270/display-the-user-presence-status-using-skype-web-sdk-or-ucwa-in-uwp-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!