Distribution groups

Lync 2013

Core concepts

Learn about the Lync 2013 distribution group and the classes and events in the Microsoft Lync 2013 SDK that let you programmatically iterate on the contacts and any nested distribution groups.

Last modified: December 10, 2012

Applies to: Lync 2013 | Lync Server 2013

A Lync 2013 distribution group is a collection of contacts and can nest other distribution groups. A distribution group is an Active Directory directory service group that can be modified using an Exchange Server 2013 Exchange Administration Center console. You cannot modify a distribution group by using the Lync 2013 client or a Microsoft Lync Server 2013 component such as a cmdlet or Microsoft Lync Server 2013 SDK.

The state of a distribution group is expanded or unexpanded when you get it from the collection of groups returned by reading the ContactManager.Groups property. If it is not expanded, you must expand it before you can get any of the contacts or nested distribution groups that it contains. Expanding a distribution group does not expand any distribution groups nested within it. You must expand each distribution group individually. If you wanted to get all contacts in the top level distribution group and all contacts in all levels of nested distribution groups, you would recursively expand nested groups and get the contacts group by group.

Caution note Caution

Recursively expanding all nested distribution groups within a distribution group can result in a memory-related exception if many large distribution groups are nested within a distribution group or there are many levels of nesting. It is better to expand one level of nested group at a time and show the results of that expansion in your UI. A user can choose to expand deeper nesting levels selectively, thereby reducing the risk of a memory exception.

A Lync distribution group is a type of contact group and inherits the base Microsoft.Lync.Model.Group.Group class although none of the base methods can be called on a distribution group. The Lync 2013 API provides the Microsoft.Lync.Model.Group.DistributionGroup class to encapsulate the unique features of the distribution group. These features include the ability to expand the distribution group if it is not expanded.

The DistributionGroup class exposes an event for the following actions.




The distribution group description changed.


The distribution group has been expanded.


A nested distribution group has been added as a member of the group raising the event.


A nested distribution group has been removed as a member of the group raising the event.

The DistributionGroup class lets you perform the following operations.




This asynchronous operation expands a distribution group to give you access to the group members. When expanded, the distribution group remains expanded.


This operation returns all of the contacts and distribution groups contained in a distribution group. The operation expands the group and any nested groups if unexpanded.


This operation returns the owner of a distribution group as a Microsoft.Lync.Model.Contact object.