This documentation is archived and is not being maintained.

Handle Contact Group Events

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

In the course of publishing contact group related actions, several group related events can be raised. The Unified Communications Client API client must be equipped to handle these events to be a fully featured communications client. By registering event handlers for these group events, the Unified Communications Client API client meets this requirement.

The following events can be raised in the course of a session:

  • Contact added to group event. This event is raised when a local user publishes the addition of a contact to a published contact group.
  • Contact removed from group event. This event is raised when a local user removes a contact previously published to a contact group.
  • External Uri changed event. This event is raised when a distribution group Uri changes.
  • Group extension changed. This event specifies the group whose application-specific data changes.

Example

The following C# examples handle the previously listed group events. To receive these events, it is necessary to advise an interested group object of the custom class object implementing the callback functions. The custom class must implement the _IUccGroupEvents dispinterface.


public class Group : _IUccGroupEvents
{
    private IUccGroup _group;
// ... class code 
    void _IUccGroupEvents.OnContactAdded(
        UccGroup pEventSource, 
        UccContactCollectionEvent pEventData)
    {
        updatePublicProperties();

    }
    void _IUccGroupEvents.OnContactRemoved(
        UccGroup pEventSource,
        UccContactCollectionEvent pEventData)
    {
        updatePublicProperties();
    }
    void _IUccGroupEvents.OnExternalUriChanged(
        UccGroup pEventSource, object pEventData)
    { }
    void _IUccGroupEvents.OnGroupExtensionChanged(
        UccGroup pEventSource, object pEventData)
    { }
    void _IUccGroupEvents.OnNameChanged(
        UccGroup pEventSource, object pEventData)
    {
        _group = pEventSource;
        updatePublicProperties();
    }
    private void updatePublicProperties()
    {
        if (this._group.GroupType == UCC_GROUP_TYPE.UCCGT_DISTRIBUTION_GROUP)
            this._groupType = "Distribution Group";
        if (this._group.GroupType == UCC_GROUP_TYPE.UCCGT_USER_DEFINED_GROUP)
            this._groupType = "User Defined Group";

        if (this._group.Contacts.Count > 0)
        {
            this._contacts.Clear();
            foreach (IUccContact c in this._group.Contacts)
            {
                if (c != null)
                    this._contacts.Add(c.Uri.UserAtHost);
            }
        }
    }
}
Show: