Using Lync 2010 SDK with Powershell
Hallo zusammen,
Ich habe ein bisschen mit Powershell und dem Lync 2010 SDK herumgespielt. Damit kann man den Lync Client quasi fernsteuern. Das SDK benötigt aber einen gestarteten Lync Client. Eine übersicht über die verschiedenen Lync API's gibt der folgende Link http://www.codelync.com/an-overview-of-the-lync-apis/
- Lync 2010 SDK Documentation
http://msdn.microsoft.com/en-us/library/lync/gg421054(v=office.14).aspx - Lync 2010 SDK
http://www.microsoft.com/en-us/download/details.aspx?id=18898
#Importing SDK Dll
[string]$LyncModelDll = "C:\Program Files (x86)\Microsoft Lync\SDK\Assemblies\Desktop\Microsoft.Lync.Model.dll"
Import-Module -Name $LyncModelDll
#Get Lync Client State
$objLyncClient = [Microsoft.Lync.Model.LyncClient]::GetClient()
Write-Host = "State: " $objLyncClient.State
# Sign Lync in to Lync Server 2010, if Lync is not already signed in to the server.
if ($objLyncClient.State -ne [Microsoft.Lync.Model.ClientState]::SignedIn)
{
$objLyncClient.EndSignIn(
$objLyncClient.BeginSignIn("a.bohren@icewolf.ch", $Null, $Null, $Null, $Null))
#$objLyncClient.BeginSignIn("user@domain.tld", "Domain\Username", "Password", $null, $null))
}
#Sign Out
$objLyncClient.EndSignOut($objLyncClient.BeginSignOut($null,$null))
#Set to Busy
$self = $objLyncClient.Self
$availability = 6500
$contactInfo = new-object 'System.Collections.Generic.Dictionary[Microsoft.Lync.Model.PublishableContactInformationType, object]'
$contactInfo.Add([Microsoft.Lync.Model.PublishableContactInformationType]::Availability, $availability)
$ar = $self.BeginPublishContactInformation($contactInfo, $null, $null)
$self.EndPublishContactInformation($ar)
#Set to Free
$self = $objLyncClient.Self
$availability = 3500
$contactInfo = new-object 'System.Collections.Generic.Dictionary[Microsoft.Lync.Model.PublishableContactInformationType, object]'
$contactInfo.Add([Microsoft.Lync.Model.PublishableContactInformationType]::Availability, $availability)
$ar = $self.BeginPublishContactInformation($contactInfo, $null, $null)
$self.EndPublishContactInformation($ar)