Lync Property Collections

[This is preliminary documentation and is subject to change.]

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

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

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 TryGetValue method 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 DefaultContactEndpoint setting 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 Contact representing the local user. To display the Uri of the default contact endpoint, the example tries to get the property using the DefaultContactEndpoint enumerator. If a default contact endpoint was not set, the call into TryGetValue would return false. Otherwise, the out parameter object is not null and can be cast to the appropriate type.

            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);
            }


Community Additions

Show:
© 2014 Microsoft