i found the answer:
Download SDK from here
https://www.microsoft.com/en-gb/download/details.aspx?id=36824
install and look Can't install Lync 2013 SDK with Skype for Business 2016
A simple solution is to extract the .exe installer with 7-zip or
some other program. After you unzip it, just run the corresponding
.msi installers.
go to folder:
C:\Program Files (x86)\Microsoft Office 2013\LyncSDK\Assemblies\Desktop
find "Microsoft.Lync.Model.dll" add "Microsoft.Lync.Model.dll" to project as reference.
if you want to check your status :https://blog.thoughtstuff.co.uk/2014/08/microsoft-lync-desktop-development-how-to-get-started/
var theClient = LyncClient.GetClient();
Contact self = theClient.Self.Contact;
object obj = self.GetContactInformation(ContactInformationType.Availability);
string stringval=self.GetContactInformation(ContactInformationType.Availability).ToString();
if you want to check other person's status via e-mail
Contact contact = theClient.ContactManager.GetContactByUri("xx@example.com");
object zzz = contact.GetContactInformation(ContactInformationType.Availability);
These are the stringval values=
https://rcosic.wordpress.com/2011/11/17/availability-presence-in-lync-client/
Invalid (-1),
None (0) – Do not use this enumerator. This flag indicates that the cotact state is unspecified.,
Free (3500) – A flag indicating that the contact is available,
FreeIdle (5000) – Contact is free but inactive,
Busy (6500) – A flag indicating that the contact is busy and inactive,
BusyIdle (7500) – Contact is busy but inactive,
DoNotDisturb (9500) – A flag indicating that the contact does not want to be disturbed,
TemporarilyAway (12500) – A flag indicating that the contact is temporarily away,
Away (15500) – A flag indicating that the contact is away,
Offline (18500) – A flag indicating that the contact is signed out.
FULL CODE (i put inside timer ):
using Microsoft.Lync.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
namespace UserStatus
{
public class DoThis
{
private readonly Timer _timer;
public DoThis()
{
_timer = new Timer(1000 * 2) { AutoReset = true };
_timer.Elapsed += TimerElapsed;
}
private void TimerElapsed(object sender, ElapsedEventArgs e)
{
DoThis2();
}
public void Start()
{
_timer.Start();
}
public void Stop()
{
_timer.Stop();
}
void DoThis2()
{
Stop();
var theClient = LyncClient.GetClient();
Contact self = theClient.Self.Contact;
if ((self.GetContactInformation(ContactInformationType.Availability)).ToString() == "6500")
{
Console.WriteLine("busy");
}
if ((self.GetContactInformation(ContactInformationType.Availability)).ToString() == "3500")
{
Console.WriteLine("available");
}
if ((self.GetContactInformation(ContactInformationType.Availability)).ToString() == "15500")
{
Console.WriteLine("away");
}
Start();
}
}
}