I’m making an communication program using Lync. I have made it call another lync user. But what the program dosn’t take in consideration wether the user is online ore not. I found some code that does the job.
var contact = (Contact)contactList.SelectedValue;
if ((ContactAvailability)contact.GetContactInformation(ContactInformationType.Availability) != ContactAvailability.Offline)
{
_conversationManager.AddConversation();
}
But what I liked is instead use the login name as an string "sip:someuser@domain.onmicrosoft.com", because that’s have I have to use it, because of have the system is setup. But it seems that I can only do it with an Lync Contact. But as I see it, it’s not easy to add an contact programmly.
Update: I have tried using the PresenceIndicator Lync Control. But it’s seemed to work. It doesn’t change the status color eventrue I can call the person.
You do not need to add a contact, just create a new contact from the sip uri, and use the resulting Contact object.
You’ll need:
ContactManager::GetContactByUri
Finds or creates a new contact using the contact URI. The URI can be a SIP address or a phone number.
Hope it helps