A property collection allows a class to expose a single collection object that contains many individual values. You typically use Microsoft Lync 2010 API enumerations to specify a property in a collection when you read or update the property value. Several Lync 2010 API classes use this functionality to store values of different types in one location.

Property Classes

Lync 2010 API provides several classes of property bags that you access by reading a specified property from an instance of a class.

Category of Property

Exposing Lync 2010 API class

Property Name

Property Access Enumeration

Contact Settings

Microsoft.Lync.Model . . :: . . Contact

Contact . . :: . . Settings

Microsoft.Lync.Model . . :: . . ContactSetting

Contact information

Microsoft.Lync.Model . . :: . . Contact

Contact . . :: . . GetContactInformation

Microsoft.Lync.Model . . :: . . ContactInformationType

Conversation Properties

Microsoft.Lync.Model.Conversation . . :: . . Conversation

Conversation . . :: . . Properties

Microsoft.Lync.Model.Conversation . . :: . . ConversationProperty

Conversation Participant Properties

Microsoft.Lync.Model.Conversation . . :: . . Participant

Participant . . :: . . Properties

Microsoft.Lync.Model.Conversation . . :: . . ParticipantProperty

Modality Properties

Microsoft.Lync.Model.Conversation . . :: . . Modality

Modality . . :: . . Properties

Microsoft.Lync.Model.Conversation . . :: . . ModalityProperty

Property Values

None of the property values from the previous table are guaranteed to be non-null when you attempt to get them. Before referring to a property value, you should be sure the property is not null. Contact information property values are obtained with a call into Contact . . :: . . GetContactInformation . The returned value can be null. The contact setting, conversation property, participant property, and modality property collection items are obtained using the TryGetValuemethod on each type's property Dictionary. You check the Boolean return value before accessing the out parameter of the method.

The individual property item values you get or set on a enumerated property are typed as object . To access the actual type of the property value, you cast the object to the type described by the appropriate enumerator. For example, you cast the object returned from the DefaultContactEndpointsetting to the Microsoft.Lync.Model . . :: . . ContactEndpoint type so that you can access the member properties of the contact endpoint.

The following example gets the collection of setting properties from the Contactrepresenting the local user. To display the Uri of the default contact endpoint, the example tries to get the property using the DefaultContactEndpointenumerator. If a default contact endpoint was not set, the call into TryGetValuewould return false. Otherwise, the outparameter object is not null and can be cast to the appropriate type.

C#  Copy imageCopy Code
			IDictionary<ContactSetting, object>
_ContactSettings = _LyncClient.Self.Contact.Settings;
			object outObject;

			if
(_ContactSettings.TryGetValue(ContactSetting.DefaultContactEndpoint,
out outObject))
			{
				Console.WriteLine("Contact endpoint Uri: " +
((ContactEndpoint)outObject).Uri);
		}

See Also