Reputation: 61
I am trying to access Microsoft Teams client COM object.
As it was possible with Skype For Business with Lync client object in PowerShell.
Exactly opposite to this.
[Reflection.Assembly]::LoadFile("C:\temp\Microsoft.Lync.Model.dll")
[Reflection.Assembly]::LoadFile("C:\temp\microsoft.office.uc.dll")
$lyncclient = [Microsoft.Lync.Model.LyncClient]::GetClient()
$lyncclient2 = [Microsoft.Lync.Model.ContactInformationType]::Availability
$lyncclient.Self.Contact.GetContactInformation($lyncclient2);
This code results in presence of current Lync/Skype user.
$teamsClient = [Microsoft.Office.Uc.IUCOfficeIntegration]
$teamsClient.GetInterfaces()
Following small article https://www.msxfaq.de/teams/api/teams_presence.htm I am not even able to recieve Com obj list in Get-ChildItem HKLM only in Get-ChildItem HKCU.
My goal is to use the same functionality as Outlook does, to read presence of users in MS Teams.
Upvotes: 3
Views: 2499
Reputation: 901
Teams is still exposing a few functionalities via COM. Its implementing the IUCOfficeIntegration interface, so Microsoft Outlook can show the Teams availibility status of a contact in Outlook itself.
More Infos on how the Office Integration works can be found here.
I just describe quickly what i have done to receive availibility informations via COM. Notice that this is C# code. I hope that it still helps.
Getting the ClassID of the Teams COM Class.
When Outlook and Teams is installed, Teams will register itself as an IM Application capable of providing availibility informations to Outlook. This is done by writing a few registry nodes. The ClassID can be found here Computer\HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\IM Providers\Teams
Getting Availibilities:
To do so i basically reversed all of the steps of the linked article showing how to implement a client for Office Integration, because i want to consume the Teams client. Notice that the Lync SDK needs to be installed (https://www.microsoft.com/en-us/download/details.aspx?id=36824) because all of the Office Integration Interfaces are defined in it. (Reference to Microsoft.Office.Uc.dll needed). Maybe this library can be
class Program
{
static void Main()
{
var version = "15.0.0.0";
var teams = (IUCOfficeIntegration) new TeamsOfficeIntegration();
var client = (IClient) teams.GetInterface(version, OIInterface.oiInterfaceILyncClient);
var contactManager = client.ContactManager;
var uri = "[email protected]";
var contact = contactManager.GetContactByUri(uri);
var availibility =
(ContactAvailability) contact.GetContactInformation(ContactInformationType.ucPresenceAvailability);
}
[ComImport, Guid("00425F68-FFC1-445F-8EDF-EF78B84BA1C7")]
public class TeamsOfficeIntegration
{
}
}
I will try to upload a small project to GitHub to demonstrate....
As Powershell is based on .NET this should somehow be possible as well. Or a small C# Interop library could be written.
Upvotes: 5
Reputation: 3581
Teams does not use COM at all and never will.
We plan to support presence APIs in Microsoft Graph bit do not have a date to share.
Upvotes: 0