Skip to content
This repository has been archived by the owner on Mar 7, 2019. It is now read-only.

kenakamu/UCWA2.0-CS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

C# library for UCWA 2.0

This is a sample library for C# developer to consume UCWA 2.0 (Unified Communication Web API) of Office 365 Skype Service. For more detail about the Web API, please refer to Skype Developer Site (https://ucwa.skype.com)

The library is PCL so you can include it in any platform such as UWP, Console, Xamarin, etc. All methods are marked as async and all events are exposed as event so that you can subscribe to handle them. See test client for more detail.

HOW TO TRY

This solution contains two projects. UCWASDK is main project which is C# wrapper. TestClient is console application using it. Once download the solution, do the following.

  1. Register your application in your Azure AD tenant.
  2. Login to https://manage.windowsazure.com.
  3. Select "Active Directory"
  4. Select your directory, and go to "APPLICATIONS" tab.
  5. Click "ADD" button on the bottom.
  6. Enter any name, and select "NATIVE CLIENT APPLICATION".
  7. Enter any REDIRECT URI. It is not used in this sample but you can specify any valid URI.
  8. Once application created, select CONFIGURE tab.
  9. Copy "CLIENT ID" for step 2.
  10. Scroll down the page and click "Add application".
  11. Select "Skype for Business Online" and click "OK" (check mark)
  12. Select Delegated Permissions as you need.
  13. Click "SAVE" button to save it.
  14. Open TokenService.cs file under TestClient or UCWAUWP project and update the values.
  15. Compile all solution.
  16. Run TestClient project and try it.

AUTHENTICATION

The wrapper contains all UCWA related class, enums and methods. However authentication is out of scope as each platform may use slightly different method. To authenticate user, use Active Directory Authentication Library (ADAL).

BASICS

1. Add using to your code.

using Microsoft.Skype.UCWA;
using Microsoft.Skype.UCWA.Enums;
using Microsoft.Skype.UCWA.Models;

2. Instantiate UCWAClient.

UCWAClient client = new UCWAClient();

3. Subscribe SendingRequest to authenticate. You can also subscribe any other events as you need.

// Write some code to obtain accesstoken. You can use ADAL.
client.SendingRequest += (client, resource) => { client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", accesstoken); };
// For example, handle message received event.
client.MessageReceived += Client_MessageReceived;

4. Instantiate and SignIn.

await client.Initialize("<your tenant id>");
await client.SignIn(availability:Availability.Online, supportMessage:true, supportAudio:false, supportPlainText:true, supportHtmlFormat:false, phoneNumber:"", keepAlive:true);

5. Do anything you need.

SPECIAL THANKS TO

Tam Huynh to help me start the project. https://github.com/tamhinsf/ucwa-sfbo-console
David Newman to help me drive the project. https://www.youtube.com/watch?time_continue=4&v=Epqrsexnn5g
Adam Hodge and Maxwell Roseman for encourage me.