Bridge Communications

Monday, November 10, 2014

Getting Lync Contact Information

In this post we'll talk about using the Lync client sdk to get information from a contact.  I am going to assume for this post that you have figured out how to add the proper references and hook to the existing Lync client in a fashion like this;

LyncClient lc;
lc = LyncClient.GetClient();

Once we have that we are given the ability to access the contact manager.  We can get Lync to kick us back all the contact details by calling a method named GetContactByURI(string uri)  This is pretty self explanatory as we pass it a uri like and it returns us a contact object.

Contact c = lc.ContactManager.GetContactByUri("");

From here we can examine properties of the contact with ease.  Since we have our contact object c, we will open the properties method on it, and expose this;


Since the code returns a type of object in this case I want to cast the name as a string value.  Some of the other types of contact information we can gather are as follows;

ContactEnpoints (like mobile number, voicemail id, etc)
Default Note

The full list is here

You can find these values in the Microsoft.Lync.Model namespace.

As always if you get stuck feel free to comment or ask for help.

Doug Routledge, C# Lync, SQL, Exchange, UC Developer

No comments:

Post a Comment

Any spam comments will be deleted and your user account will be disabled.