A group is a collection of contacts. When a group is a distribution group, additional distribution groups can be nested within the first distribution group. The collection of groups for a client is accessed from ContactManager property of the client. The group collection is persisted on Microsoft Lync Server 2010 and provided to Microsoft Lync 2010 when the user signs in. You catch these provisioning events when you register for contact and group events on the instance of ContactManager .

Up to 200 contacts and 64 groups can be added to a user's contact list. The group limit includes a fixed number of default groups and the balance is made up of custom groups. The 200 unique contacts can be added to multiple groups.

The following group types are defined and provisioned by Lync Server 2010.

Group Type

Description

Custom Group

Each client contains one custom group by default. You can add, rename, or remove custom groups. A custom group can contain only individual contacts. A single contact can be added to multiple custom groups.

Distribution Group

A single Microsoft Lync 2010 API group that contains e-mail distribution groups defined within an organization's e-mail infrastructure such as Microsoft Exchange. Users can add or remove distribution groups but change the membership of a distribution group using either Lync or the Microsoft Lync 2010 SDK.

FavoriteContacts

A single group defined by the system. Users can add contacts to this group.

FrequentContacts

A single group defined by Lync. Group membership is defined based on frequency of contact. The order in which contacts appear in the group is determined by the most recent conversation. You receive a ContactPositionChanged event when Lync Server 2010 changes the order in this group.

For information about retrieving a list of the groups for a client, see Walkthrough: Fill a Contact List .

The following figure illustrates the properties and events available from the Group class.

Adding an Instance of the Group Class

Users can add custom groups and distribution groups. Custom groups are added by calling the BeginAddGroup method. Distribution groups are added by calling the BeginAddGroup method. For more information about adding a group, including an example, see Walkthrough: Add, Remove, and Rename Custom Groups .

Removing an Instance of the Group Class

Users can remove custom groups that they created and distribution groups. Groups are removed by calling the BeginRemoveGroup method. For more information about removing a group, including an example, see Walkthrough: Add, Remove, and Rename Custom Groups .

Adding and Removing Contacts in a Group

Contacts can be added and removed from custom groups, distribution groups, and the favorite contacts group. To add or remove a contact, call the BeginAddContact method or the BeginRemoveContact method on a on a Group instance, passing the contact to be removed as a parameter. For more information about using these methods, including examples, see Walkthrough: Add and Remove Contacts in a Group .

You can register for the ContactAdded event and the ContactRemoved event for the Group instance to react to the change in the group's contact collection. For example, you can update the group list in your user interface when one of these events is raised. For more information about handling group events, see Handle Events for a Group .

For information about retrieving a list of the contacts in a group, see Walkthrough: Fill a Contact List .

Retrieving Group Properties

There are three public properties for an instance of the Group class:

  1. Id

  2. Name

  3. Type

You can change the name of a user-defined custom group. To rename a group, you must first cast the Group instance as an instance of the CustomGroup class, and then call the BeginRename method of the CustomGroup class. You can register for the NameChanged event on CustomGroup instance. For more information about renaming a group, including an example, see Walkthrough: Add, Remove, and Rename Custom Groups .

See Also