Add a Contact to the Contact List

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.

A Unified Communications Client API application adds a new contact to a user's contact list by publishing a new instance of the contacts category to the server. The application must set the value of the PublicationOperation property on the to-be-published category instance as UCC_PUBLICATION_OPERATION_TYPE.UCCPOT_ADD. If a previously published category instance is being republished with modifications, the operation type must also be UCC_PUBLICATION_OPERATION_TYPE.UCCPOT_ADD. The publication is mostly useful for persisting a user's contact list between the user's logon sessions.

In Unified Communications Client API, a contact is represented by an IUccContact object, which is a strongly typed category instance. The application can create a publishable contact by first calling the CreatePublishableCategoryInstance method, specifying contacts as the value of the string input parameter for the category name. The application can then proceed to set the contact properties (for example, the contact's URI) by casting the IUccCategoryInstance object into the IUccContact type. The contact must be published to the container with Id UCC_SELF_CONTAINER_ID.


Each new contact added or updated must be published in a dedicated publication object. Only one contact object is allowed per publication.

The following C# code snippet illustrates how to publish a contact to the private container.

partial class ContactManager
    /// <summary>
    /// Adds a contact to the contact list by publishing it to the server
    /// </summary>
    /// <param name="contactURI">URI of the contact to be added</param>
    public void addContact(UccUri contactURI)
            //Create a publishable category instance representing the contact to be added
            IUccCategoryInstance cat = publicationManager. CreatePublishableCategoryInstance(
                    , UccConstants.UCC_SELF_CONTAINER_ID
                    , 0  //instance mask
                    , 0);

            //Set publication operation type for this category
            cat.PublicationOperation = UCC_PUBLICATION_OPERATION_TYPE.UCCPOT_ADD;
            //Cast the category to IUccContact to set the URI of the contact to be added
            IUccContact contact = cat as IUccContact;
            contact.Uri = contactURI;

            IUccPublication pub = publicationManager.CreatePublication();
            UCC_Advise<_IUccPublicationEvent>(pub, this);
        catch (Exception ex)

See Also


Create Contact List Subscription
Add a Contact to the Contact List
Remove a Contact from the Contact List
Granting Permissions to View Published Presence States
Publish Category Instances
Sample Contact Presence Handling Class
Category and Category Instances
Publication and Subscription Objects