Share via


CreateCategory Method (String, String)

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 _
) As Category
'Usage
Dim instance As ProductCatalog
Dim definitionName As String
Dim categoryName As String
Dim returnValue As Category

returnValue = instance.CreateCategory(definitionName, _
    categoryName)
public Category CreateCategory(
    string definitionName,
    string categoryName
)
public:
Category^ CreateCategory(
    String^ definitionName, 
    String^ categoryName
)
public function CreateCategory(
    definitionName : String, 
    categoryName : String
) : 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).

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.

Permissions

See Also

Reference

ProductCatalog Class

ProductCatalog Members

CreateCategory Overload

Microsoft.CommerceServer.Catalog Namespace