IProductCatalog::CreateCategory

Ee798246.c++_off(en-US,CS.10).gifEe798246.vb_on(en-US,CS.10).gif

Use this method to create a new category.

Definition

HRESULT IProductCatalog::CreateCategory(BSTRstrDefinitioName,BSTRstrCategoryName,VARIANTstrParentCategoryName,VARIANTfIsSpecificationSearchable,ICategory**ppCategory);

Parameters

strDefinitioName

[in] A BSTR that contains the name of the category definition on which the category is based.

strCategoryName

[in] A BSTR that contains the name of the category to be created.

strParentCategoryName

[in, optional] A VARIANT that contains the name of the category that will be a parent to this new category, if any.

IsSpecificationSearchable

[in, optional] A VARIANT that determines whether or not this category is to be specification searchable.

ppCategory

[out, retval] A pointer to an ICategory object used to return the newly created category.

Return Values

This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.

Error Values

This method returns S_OK (0x00000000) to indicate success and either standard or custom COM HRESULT error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.

The following table shows the custom COM errors that this method can return.

Constant Value Description
E_CAT_CATEGORY_DOESNT_EXIST 0x8898001C The specified parent category did not exist.
E_CAT_CATEGORY_EXISTS 0x8898001D The specified name for the new category was already in use.

Category names must be globally unique across the entire system.

E_CAT_DEFINITION_DOESNT_EXIST 0x8898000B The specified definition did not exist.
E_CAT_INVALID_CATEG_LENGTH 0x88980047 The category name exceeded 128 characters.
E_CAT_PRODUCT_DEFN_FOR_CATEGORY 0x8898004B The definition specified was not a category definition but a product definition.

Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.

Remarks

The ppCategory parameter contains valid data only if the property was accessed successfully.

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

See Also

ProductCatalog Object

IProductCatalog::GetCategory

IProductCatalog::DeleteCategory


All rights reserved.