Share via


CreateCategory Method (String, String, Boolean)

Creates a Category in the current catalog.

Namespace:  Microsoft.CommerceServer.Catalog
Assembly:  Microsoft.CommerceServer.Catalog (in Microsoft.CommerceServer.Catalog.dll)

Syntax

'Declaration
Public Function CreateCategory ( _
    definitionName As String, _
    categoryName As String, _
    specificationSearchable As Boolean _
) As Category
'Usage
Dim instance As ProductCatalog
Dim definitionName As String
Dim categoryName As String
Dim specificationSearchable As Boolean
Dim returnValue As Category

returnValue = instance.CreateCategory(definitionName, _
    categoryName, specificationSearchable)
public Category CreateCategory(
    string definitionName,
    string categoryName,
    bool specificationSearchable
)
public:
Category^ CreateCategory(
    String^ definitionName, 
    String^ categoryName, 
    bool specificationSearchable
)
public function CreateCategory(
    definitionName : String, 
    categoryName : String, 
    specificationSearchable : boolean
) : Category

Parameters

  • definitionName
    Type: System..::.String
    The category definition name. Should not be nullNothingnullptra null reference (Nothing in Visual Basic).
  • categoryName
    Type: System..::.String
    The category name. Should not be nullNothingnullptra null reference (Nothing in Visual Basic).
  • specificationSearchable
    Type: System..::.Boolean
    true to mark this category as specification-searchable; otherwise, false.

Return Value

Type: Microsoft.CommerceServer.Catalog..::.Category
A new Category object containing the new category.

Exceptions

Exception Condition
EntityDoesNotExistException

The definitionName does not exist.

InvalidDefinitionUseException

The definitionName is not a category definition.

EntityAlreadyExistsException

The categoryName already exists.

NotAuthorizedException

The caller is not authorized to perform this operation.

Remarks

This method creates a new Category in the catalog based on the definitionName and returns a Category object. You do not need to call Save after you call this method. You can use this object to access and update information about the category. If you make any changes to the category you should call the Save method to save the changes to the category.

The definitionName should:

  • Not be nullNothingnullptra null reference (Nothing in Visual Basic) or blank.

  • Not exceed 128 characters.

  • Be an existing category definition in the catalog system.

The categoryName should:

  • Not be nullNothingnullptra null reference (Nothing in Visual Basic) or blank.

  • Not exceed 128 characters.

  • Not already exist in the catalog.

You can mark a category as specification searchable by setting the specificationSearchable to true.

Permissions

See Also

Reference

ProductCatalog Class

ProductCatalog Members

CreateCategory Overload

Microsoft.CommerceServer.Catalog Namespace