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 |
|
|
|
Contact information |
|
|
|
Conversation Properties |
|
|
|
Conversation Participant Properties |
|
|
|
Modality Properties |
|
|
|
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
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
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 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); } |