Home > OCS 2007 / Lync 2010 > Lync 2010: Contact Information Sample

Lync 2010: Contact Information Sample

Lync 2010 SDK included also a Contact Information Sample which can retrieve the current presence status and modify it. Moreover it is possible to sign out the user and modify the personal notes. This sample uses the currently signed in user.

Prerequisites (for compiling and running in Visual Studio)

  • .Net Framework 3.5 or above.
  • Visual Studio 2008 or 2010
  • Microsoft Lync SDK

Prerequisites (for running installed sample on client machines)

  • Microsoft Lync must be installed and running.

Features include:

  • Get information of a Lync contact such as the name, photo, current availability and personal note.
  • Publish information of the Self contact, such as availability and personal note.
  • Sign in to Lync using the credentials of the user currently logged in to the machine.
  • Sign out from Lync.
  • Handle Lync events to respond to changes in the client state and changes in the contact information

The sample:

Result

For example in the class below you can see how to modify the peronal note: lyncClient.Self.Contact.GetContactInformation is mainly used to get and set persence status, peronal note, displayname,..

        private void SetPersonalNote()
        {
            string text = string.Empty;
            try
            {
                text = lyncClient.Self.Contact.GetContactInformation(ContactInformationType.PersonalNote)
                              as string;
            }
            catch (LyncClientException e)
            {
                Console.WriteLine(e);
            }
            catch (SystemException systemException)
            {
                if (IsLyncException(systemException))
                {
                    // Log the exception thrown by the Lync Model API.
                    Console.WriteLine("Error: " + systemException);
                }
                else
                {
                    // Rethrow the SystemException which did not come from the Lync Model API.
                    throw;
                }
            }

            personalNoteTextBox.Text = text;
        }

more info: http://msdn.microsoft.com/en-us/library/gg436843.aspx

Advertisements
Categories: OCS 2007 / Lync 2010
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: