How to get client's contact details in lync sdk c#

889 Views Asked by At

Which Object has the client contact information like office,company,IM, etc,. in Lync SDK 2013? I want to know the user's(client's) location/address information.

2

There are 2 best solutions below

0
Rafael On BEST ANSWER

In addition to Kannan's answer, getting the phone numbers from a contact is different and requires more work. Here's how you do it:

LyncClient lyncClient = LyncClient.GetClient();
Contact contact = lyncClient.ContactManager.GetContactByUri("sip:[email protected]");

List<object> endPoints = new List<object>();
var telephoneNumber = (List<object>)contact.GetContactInformation(ContactInformationType.ContactEndpoints);
endPoints = telephoneNumber.Where<object>(N => ((ContactEndpoint)N).Type == ContactEndpointType.HomePhone || ((ContactEndpoint)N).Type == ContactEndpointType.MobilePhone || ((ContactEndpoint)N).Type == ContactEndpointType.OtherPhone || ((ContactEndpoint)N).Type == ContactEndpointType.WorkPhone).ToList<object>();

foreach (var endPoint in endPoints)
{
    //((ContactEndpoint)endPoint).DisplayName.ToString(); //This is the phone number in string format
}
0
Kannan T On

User location/office information can be obtained from contact object as given below:

LyncClient lyncClient = LyncClient.GetClient();
Contact contact = lyncClient.ContactManager.GetContactByUri("sip:[email protected]");
String officeLocation = contact.GetContactInformation(ContactInformationType.Office).ToString();

More information can be obtained using Contact information types Personal Note, Company, Location, Department etc.