Share via


IUccCategoryInstance.Value Property

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.

Gets and sets the value of a non-type specific category instance.

Namespace: Microsoft.Office.Interop.UccApi
Assembly: Microsoft.Office.Interop.UccApi (in microsoft.office.interop.uccapi.dll)

Syntax

'Declaration
Property Value As String
string Value { get; set; }
property String^ Value {
    String^ get ();
    void set (String^ value);
}
/** @property */
String get_Value ()

/** @property */
void set_Value (String value)
function get Value () : String

function set Value (value : String)

Property Value

A value of the BSTR* (string, for a .NET application) type.

Remarks

The string assigned to the Value property must be a valid XML string. A client application may define an XML schema to enforce a custom XML structure. For type-specific category instances this value is NULL. An IUccContact instance is an example of a type-specific category instance.

Win32 COM/C++ Syntax

HRESULT get_Value
(
   BSTR* pbstrData
);
HRESULT put_Value
(
   BSTR pbstrData
);

Note

In a Win32 application, the return value of a method or property is always an HRESULT value indicating the status of the call to the interface member. Any result of the operation is returned as a parameter marked with the [out, retval] attribute. In contrast, in a .NET application the HRESULT value indicating an error condition is returned as a COM exception and the [out, retval] parameter becomes the return value. For the UCC API-defined HRESULT values, see Trace and Handle Errors in Unified Communications Client API.

Example

The following example publishes a custom category instance using the contexts of a locally persisted XML formatted document. The example method validates the XML against a schema and fills the Value property of the category instance with an XML string originating in the persisted XML document.

/// <summary>
/// Publishes a custom category with a passed category name, value and Id
/// </summary>
/// <param name="CatName">Name of category</param>
/// <param name="inputUri">path to XML document</param>
/// <param name="CatId">integer category Id</param>
public void publishCustomCategory(string CatName, string inputURI, int CatId)
{
    IUccContainer newContainer = createCustomContainer(CatId);
    //   Create a publishable category instance representing the contact to be added
    if (newContainer != null)
    {
        string categoryName = pubMgr.GetPresenceCategoryName(
        UCC_PRESENCE_CATEGORY_TYPE.UCCPCT_UC_USERPROPERTIES);

        IUccCategoryInstance cat = pubMgr.CreatePublishableCategoryInstance(
            categoryName,
            newContainer.Id,
            0,
            UCC_CATEGORY_INSTANCE_EXPIRE_TYPE.UCCCIET_STATIC,
            0);

        //Set publication operation type for this category
        cat.PublicationOperation = UCC_PUBLICATION_OPERATION_TYPE.UCCPOT_ADD;
        XmlReaderSettings settings = new XmlReaderSettings();
        settings.Schemas.Add("http://www.contoso.com/books", "contosoBooks.xsd");
        settings.ValidationType = ValidationType.Schema;
        XmlReader reader = XmlReader.Create(inputURI, settings);
        XmlDocument xDoc = new XmlDocument();
        xDoc.Load(reader);
        try
        {
            xDoc.Validate(eventHandler);
            cat.Value = xDoc.OuterXml;
            this.PublishCategoryInstance(cat, categoryName);
        }
        catch (System.Xml.Schema.XmlSchemaValidationException) { }
        this.PublishCategoryInstance(cat, categoryName);
    }
}
static void ValidationEventHandler(object sender, ValidationEventArgs e)
{
    switch (e.Severity)
    {
        case XmlSeverityType.Error:
            Console.WriteLine("Error: {0}", e.Message);
            break;
        case XmlSeverityType.Warning:
            Console.WriteLine("Warning {0}", e.Message);
            break;
    }
}

Thread Safety

All public static (Shared in Visual Basic) members of this type are thread-safe. Instance members are not guaranteed to be thread-safe.

Platforms

Development Platforms

Windows XP Professional with Service Pack 2 (SP2), Windows Server 2000 with Service Pack 4, Windows Server 2003, Windows Vista Ultimate Edition, Windows Vista Business Edition, Windows Vista Enterprise Edition

Target Platforms

See Also

Reference

IUccCategoryInstance Interface
IUccCategoryInstance Members
Microsoft.Office.Interop.UccApi Namespace