How to change lync status using C#

Another Lync post :) This snippet will help you to change the lync status(available, away, busy etc) using C# and Lync API. As I mentioned in the earlier post, you need to install the Lync SDK.

Here is the snippet

var lyncClient = LyncClient.GetClient();
lyncClient.Self.BeginPublishContactInformation(
    new Dictionary<PublishableContactInformationType, object>() {
    { PublishableContactInformationType.Availability, ContactAvailability.Busy }
}, null, null);

In this code, I am making the availability status as Busy. You can change it to any value available in the ContactAvailability enumeration. It is always better idea to check Lync is running or not. I have not included the code for that.

Happy Programming :)