Pages Menu
TwitterRssFacebook

Posted by on Nov 17, 2018 in Development, Microsoft Teams

The Calls & Meetings API is now the Microsoft Graph Communications API, SDK package names updated

The Calls & Meetings API is now the Microsoft Graph Communications API, SDK package names updated

As the newest API and SDK pair for performing programmatic actions on Microsoft Teams calls makes its way from Public Preview to Generally Available, there are some changes happening to bring it more into line with the other Graph APIs.

Firstly, it has a new name. I much prefer this one, it’s more succinct and abstract, and means that when new features are added that aren’t specific to calls or meetings, it won’t look strange.

There are some other changes as well. These might well be breaking changes to existing applications, or if they aren’t, there will still be things you should do.

NuGet Package names have changed

That’s right – the way you get the SDK has changed. These are the new package names you should use:

Original NuGet package New NuGet package
Microsoft.Graph.Calls Microsoft.Graph.Communications.Calls
Microsoft.Graph.Calls.Media Microsoft.Graph.Communications.Calls.Media
Microsoft.Graph.CoreSDK Microsoft.Graph.Communications.Core
Microsoft.Graph.StatefulClient Microsoft.Graph.Communications.Client
Microsoft.Graph.Core.Stateful Microsoft.Graph.Communications.Common

The previous versions have been marked with the [Obselete] decorator, meaning that if you continue to use them, they will work…but you’ll receive a warning: Compiler Warning (level 2) CS0618.

Namespace names have changed

There have also been some changes to Namespaces. For instance, the IStatefulClient is now ICommunicationsClient. This will likely involve some rework to your code:

Original namespace New namespace
Microsoft.Graph.CoreSDK Microsoft.Graph.Communications.Core
Microsoft.Graph.Core Microsoft.Graph.Communications.Common
Microsoft.Graph.StatefulClient Microsoft.Graph.Communications.Client
Microsoft.Graph.Calls Microsoft.Graph.Communications.Calls
Microsoft.Graph.Calls.Media Microsoft.Graph.Communications.Calls.Media
IStatefulClient ICommunicationsClient
StatefulClientBuilder CommunicationsClientBuilder

(Some) Attributes and Method Names have changed

Again, likely to break your code on an update. These changes are mostly cosmetic and bring the naming standards in line with the rest of Graph:

Deprecated items Replacement
AudioRoutingGroup.Owner no longer used
Call.Error Call.ResultInfo
Call.Transfer(TransferTarget,…) Call.Transfer(TransferTarget)
CommsOperation.ErrorInfo CommsOperation.ResultInfo
MeetingParticipantInfo.SipProxyAddress no longer used
OnlineMeeting.CanceledTime OnlineMeeting.CanceledDateTime
OnlineMeeting.CreationTime OnlineMeeting.CreationDateTime
OnlineMeeting.EndTime OnlineMeeting.EndDateTime
OnlineMeeting.ExpirationTime OnlineMeeting.ExpirationDateTime
OnlineMeeting.MeetingInfo OnlineMeeting.Participants.Organizer
OnlineMeeting.StartTime OnlineMeeting.StartDateTime
Participant.SubscribeVideoAsync Call.GetLocalMediaSession().VideoSocket.Subscribe

Where to get this new SDK from?

The right place to download this SDK and all its sub-parts is NuGet. If you’re not familiar with it, NuGet is a nice easy way to load in external references to your code. There’s no MSI to install and you can control everything from within Visual Studio.

Check to see if you have the Package Manager Console tab visible. If not, enable it by going to Tools > NuGet Package Manager > Package Manager Console.

At a really high level, NuGet is made up of many different packages, each of which encapsulates a specific piece of functionality. What makes it clever is that each package also contains a manifest file describing any dependencies, which are other NuGet packages, as well as minimal versions etc. The Package Manager will then automatically download and install all dependent packages before the one you asked for, meaning you don’t need to know and manage all the dependencies. It’s not always that seamless, but it’s a lot better than dealing with DLLs.

You add a package by running the Install-Package command, followed by the name of the package. How do you know the name of the package? The names of all the packages that make up the Graph Communications API are listed at the top of this blog post. So, to install the Communications Client, you would type: Install-Package Microsoft.Graph.Communications.Client

Ah-Ha! Gotcha!

So, if you ran that command, this is what you’d get:

Install-Package : Unable to find package ‘Microsoft.Graph.Communications.Client’
At line:1 char:1
+ Install-Package Microsoft.Graph.Communications.Client
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Install-Package], Exception
+ FullyQualifiedErrorId : NuGetCmdletUnhandledException,NuGet.PackageManagement.PowerShellCmdlets.InstallPackageCommand

What’s going on here?  Well, the second piece of advice is probably not to trust an install command from a random blog page. 🙂  The problem is that because the Communications API is still in Public Preview, the developers have marked the latest version of the NuGet package as a pre-release version. This means that the Package Manager will act as if it’s not there…unless you specifically tell it that you’re OK with installing a pre-release version. It’s designed to allow developers to push out alpha and beta versions without everyone automatically being upgraded to them and experiencing a load of problems.

If you go to the NuGet page for this package, you’ll see the banner about it being pre-release, as well as being given another command you can run, specifying a particular version. This will install the pre-release version:

So, what happens when you run: Install-Package Microsoft.Graph.Communications.Client -Version 1.0.0-prerelease.494

Attempting to gather dependency information for package ‘Microsoft.Graph.Communications.Client.1.0.0-prerelease.494’ with respect to project ‘ConsoleApp2’, targeting ‘.NETFramework,Version=v4.6.1’
Gathering dependency information took 17.54 sec
Attempting to resolve dependencies for package ‘Microsoft.Graph.Communications.Client.1.0.0-prerelease.494’ with DependencyBehavior ‘Lowest’
Resolving dependency information took 0 ms
Resolving actions to install package ‘Microsoft.Graph.Communications.Client.1.0.0-prerelease.494’
Resolved actions to install package ‘Microsoft.Graph.Communications.Client.1.0.0-prerelease.494’
GET https://api.nuget.org/v3-flatcontainer/microsoft.extensions.logging.abstractions/2.1.1/microsoft.extensions.logging.abstractions.2.1.1.nupkg
GET https://api.nuget.org/v3-flatcontainer/microsoft.graph.communications.common/1.0.0-prerelease.494/microsoft.graph.communications.common.1.0.0-prerelease.494.nupkg
GET https://api.nuget.org/v3-flatcontainer/microsoft.graph.communications.core/1.0.0-prerelease.494/microsoft.graph.communications.core.1.0.0-prerelease.494.nupkg
GET https://api.nuget.org/v3-flatcontainer/microsoft.graph.communications.client/1.0.0-prerelease.494/microsoft.graph.communications.client.1.0.0-prerelease.494.nupkg
Retrieving package ‘Microsoft.Extensions.Logging.Abstractions 2.1.1’ from ‘nuget.org’.
Retrieving package ‘Microsoft.Graph.Communications.Client 1.0.0-prerelease.494’ from ‘nuget.org’.
Retrieving package ‘Microsoft.Graph.Communications.Common 1.0.0-prerelease.494’ from ‘nuget.org’.
Retrieving package ‘Microsoft.Graph.Communications.Core 1.0.0-prerelease.494’ from ‘nuget.org’.
Retrieving package ‘Newtonsoft.Json 6.0.1’ from ‘nuget.org’.
Retrieving package ‘System.Threading.Tasks.Dataflow 4.9.0’ from ‘nuget.org’.
OK https://api.nuget.org/v3-flatcontainer/microsoft.extensions.logging.abstractions/2.1.1/microsoft.extensions.logging.abstractions.2.1.1.nupkg 398ms
OK https://api.nuget.org/v3-flatcontainer/microsoft.graph.communications.core/1.0.0-prerelease.494/microsoft.graph.communications.core.1.0.0-prerelease.494.nupkg 410ms
Installing Microsoft.Extensions.Logging.Abstractions 2.1.1.
Installing Microsoft.Graph.Communications.Core 1.0.0-prerelease.494.
OK https://api.nuget.org/v3-flatcontainer/microsoft.graph.communications.client/1.0.0-prerelease.494/microsoft.graph.communications.client.1.0.0-prerelease.494.nupkg 804ms
Installing Microsoft.Graph.Communications.Client 1.0.0-prerelease.494.
OK https://api.nuget.org/v3-flatcontainer/microsoft.graph.communications.common/1.0.0-prerelease.494/microsoft.graph.communications.common.1.0.0-prerelease.494.nupkg 957ms
Installing Microsoft.Graph.Communications.Common 1.0.0-prerelease.494.
Adding package ‘Microsoft.Extensions.Logging.Abstractions.2.1.1’ to folder ‘C:\Users\tomrm\Source\Repos\ConsoleApp2\packages’
Added package ‘Microsoft.Extensions.Logging.Abstractions.2.1.1’ to folder ‘C:\Users\tomrm\Source\Repos\ConsoleApp2\packages’
Added package ‘Microsoft.Extensions.Logging.Abstractions.2.1.1’ to ‘packages.config’
Successfully installed ‘Microsoft.Extensions.Logging.Abstractions 2.1.1’ to ConsoleApp2
Adding package ‘Newtonsoft.Json.6.0.1’ to folder ‘C:\Users\tomrm\Source\Repos\ConsoleApp2\packages’
Added package ‘Newtonsoft.Json.6.0.1’ to folder ‘C:\Users\tomrm\Source\Repos\ConsoleApp2\packages’
Added package ‘Newtonsoft.Json.6.0.1’ to ‘packages.config’
Executing script file ‘C:\Users\tomrm\Source\Repos\ConsoleApp2\packages\Newtonsoft.Json.6.0.1\tools\install.ps1’
Successfully installed ‘Newtonsoft.Json 6.0.1’ to ConsoleApp2
Adding package ‘Microsoft.Graph.Communications.Common.1.0.0-prerelease.494’ to folder ‘C:\Users\tomrm\Source\Repos\ConsoleApp2\packages’
Added package ‘Microsoft.Graph.Communications.Common.1.0.0-prerelease.494’ to folder ‘C:\Users\tomrm\Source\Repos\ConsoleApp2\packages’
Added package ‘Microsoft.Graph.Communications.Common.1.0.0-prerelease.494’ to ‘packages.config’
Successfully installed ‘Microsoft.Graph.Communications.Common 1.0.0-prerelease.494’ to ConsoleApp2
Adding package ‘Microsoft.Graph.Communications.Core.1.0.0-prerelease.494’ to folder ‘C:\Users\tomrm\Source\Repos\ConsoleApp2\packages’
Added package ‘Microsoft.Graph.Communications.Core.1.0.0-prerelease.494’ to folder ‘C:\Users\tomrm\Source\Repos\ConsoleApp2\packages’
Added package ‘Microsoft.Graph.Communications.Core.1.0.0-prerelease.494’ to ‘packages.config’
Successfully installed ‘Microsoft.Graph.Communications.Core 1.0.0-prerelease.494’ to ConsoleApp2
Adding package ‘System.Threading.Tasks.Dataflow.4.9.0’ to folder ‘C:\Users\tomrm\Source\Repos\ConsoleApp2\packages’
Added package ‘System.Threading.Tasks.Dataflow.4.9.0’ to folder ‘C:\Users\tomrm\Source\Repos\ConsoleApp2\packages’
Added package ‘System.Threading.Tasks.Dataflow.4.9.0’ to ‘packages.config’
Successfully installed ‘System.Threading.Tasks.Dataflow 4.9.0’ to ConsoleApp2
Adding package ‘Microsoft.Graph.Communications.Client.1.0.0-prerelease.494’ to folder ‘C:\Users\tomrm\Source\Repos\ConsoleApp2\packages’
Added package ‘Microsoft.Graph.Communications.Client.1.0.0-prerelease.494’ to folder ‘C:\Users\tomrm\Source\Repos\ConsoleApp2\packages’
Added package ‘Microsoft.Graph.Communications.Client.1.0.0-prerelease.494’ to ‘packages.config’
Successfully installed ‘Microsoft.Graph.Communications.Client 1.0.0-prerelease.494’ to ConsoleApp2
Executing nuget actions took 6.83 sec
Time Elapsed: 00:00:24.5356750

If you look through the log (which is quite easy to read) you’ll see that a number of other packages have been added. These are required by the Communications Client API. We didn’t know that, but we didn’t have to – the Package Manage just added them anyway. If you now check your references list, you’ll see the Communications.Client DLL, along with a Communications.Common DLL and a Communications.Core DLL. There are also some other required DLLs (Logging, Json etc).

From there, you’re good to go, but if you need some help, check out the documentation and samples.

Ref: https://github.com/microsoftgraph/microsoft-graph-comms-samples/blob/master/changelog.md

Written by Tom Morgan

Tom is a Microsoft Teams Platform developer and Microsoft MVP who has been blogging for over a decade. Find out more.
Buy the book: Building and Developing Apps & Bots for Microsoft Teams. Now available to purchase online with free updates.

1 Comment

  1. Hello Tom.

    As far the samples and the documentation can reveal, it seems that you MUST create a bot and register it in the Azure portal. Can this be in any way avoided?

    Also, making an outgoing call is strictly limited only to the Team members, but not to an outside PSTN world. In short, you can call a person if you know it’s contact ID, but not his phone number.

    Do i get this right?

Post a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.