Change status of Lync by script

Mayank Jain picture Mayank Jain · Apr 25, 2013 · Viewed 20.9k times · Source

Is it possible to change status of Microsoft Lync 2010 by script?

I want Script which works on Win XP and change status to available after fixed interval.Tried to search in internet but was not successful in finding one.

Answer

likeitlikeit picture likeitlikeit · May 2, 2013

According to the documentation, the Lync binary does not offer that feature. However, you could use the Lync SDK to achieve what you want by writing a small helper application (or incorporating the relevant code in your current application).

According to an MVP in the Microsoft forums, this also is not available out-of-the-box.

However, according to the documentation, a PowerShell script like this one should be able to do the trick:

import-module "C:\Program Files (x86)\Microsoft Lync\SDK\Assemblies\Desktop\Microsoft.Lync.Controls.Dll"

$availability = [Microsoft.Lync.Controls.ContactAvailability]::Available

$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)

This script requires the Lync SDK or the Lync SDK redistributable to be installed.

Much of this information has been taken from here.