ProductCatalog.CreateCategory

Ee798247.c++_on(en-US,CS.10).gifEe798247.vb_off(en-US,CS.10).gif

Use this method to create a new category.

Definition

Function CreateCategory(strDefinitioName As String,strCategoryName As String,Optional strParentCategoryName As Variant,Optional fIsSpecificationSearchable As Variant) As Category

Parameters

strDefinitioName

A String that contains the name of the category definition on which the category is based.

strCategoryName

A String that contains the name of the category to be created.

strParentCategoryName

A Variant that contains the name of the category that will be a parent to this new category, if any.

fIsSpecificationSearchable

A Variant that determines whether or not this category is to be specification searchable.

Return Values

If this method completes successfully, it returns the newly created Category object.

Error Values

This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to either standard or custom COM 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 &H8898001C The specified parent category did not exist.
E_CAT_CATEGORY_EXISTS &H8898001D 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 &H8898000B The specified definition did not exist.
E_CAT_INVALID_CATEG_LENGTH &H88980047 The category name exceeded 128 characters.
E_CAT_PRODUCT_DEFN_FOR_CATEGORY &H8898004B The definition specified was not a category definition but a product definition.

Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

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

Example

SET oMyCategory = myProductCatalog.CreateCategory("BasicCategoryDefinition", "T-Shirts", "Apparel", TRUE)

See Also

ProductCatalog Object

ProductCatalog.GetCategory

ProductCatalog.DeleteCategory


All rights reserved.