Share via


GetCategory Method (String, String)

Retrieves a Category object containing information about the category.

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

Syntax

'Declaration
Public Function GetCategory ( _
    catalogName As String, _
    categoryName As String _
) As Category
'Usage
Dim instance As CatalogContext
Dim catalogName As String
Dim categoryName As String
Dim returnValue As Category

returnValue = instance.GetCategory(catalogName, _
    categoryName)
public Category GetCategory(
    string catalogName,
    string categoryName
)
public:
Category^ GetCategory(
    String^ catalogName, 
    String^ categoryName
)
public function GetCategory(
    catalogName : String, 
    categoryName : String
) : Category

Parameters

  • catalogName
    Type: System..::.String
    The name of the catalog. May 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
Use this method to retrieve the specified category from a catalog. A Category object containing information about the category. The ActiveLanguage on the returned Category object will be set to the default language of the catalog.

Exceptions

Exception Condition
ArgumentNullException

The catalogName or categoryName is nullNothingnullptra null reference (Nothing in Visual Basic).

ValidationException

One of the input parameters is invalid.

EntityDoesNotExistException

The categoryName does not exist in the catalog.

NotAuthorizedException

The caller is not authorized to perform this operation.

Remarks

The returned Category object contains multilingual information in the language specified by the language. You can use the returned Category object to access and update information about the category. If you make any changes to the returned Category object you should call the Save method to save the changes to the catalog system.

The catalogName should:

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

  • Not exceed 85 characters.

  • Not contain the .,"[]'()# characters.

  • Exist in the catalog system.

Passing nullNothingnullptra null reference (Nothing in Visual Basic) to the categoryName will return a Category object representing the root category. If categoryName is specified then it should

  • Not exceed 128 characters for a base catalog and 215 characters for a virtual catalog.

  • Exist in the catalog system.

Permissions

See Also

Reference

CatalogContext Class

CatalogContext Members

GetCategory Overload

Microsoft.CommerceServer.Catalog Namespace