Share via


GetCategory Method (String, String, String, CategoryConfiguration)

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, _
    language As String, _
    config As CategoryConfiguration _
) As Category
'Usage
Dim instance As CatalogContext
Dim catalogName As String
Dim categoryName As String
Dim language As String
Dim config As CategoryConfiguration
Dim returnValue As Category

returnValue = instance.GetCategory(catalogName, _
    categoryName, language, config)
public Category GetCategory(
    string catalogName,
    string categoryName,
    string language,
    CategoryConfiguration config
)
public:
Category^ GetCategory(
    String^ catalogName, 
    String^ categoryName, 
    String^ language, 
    CategoryConfiguration^ config
)
public function GetCategory(
    catalogName : String, 
    categoryName : String, 
    language : String, 
    config : CategoryConfiguration
) : 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. May not be nullNothingnullptra null reference (Nothing in Visual Basic).
  • language
    Type: System..::.String
    The culture code indicating the language that is associated with the Catalog. May not be nullNothingnullptra null reference (Nothing in Visual Basic).

Return Value

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

Exceptions

Exception Condition
ArgumentNullException

The catalogName,categoryName, or language 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.

If specified the language should:

  • Not exceed 10 characters.

  • Not contain the ,'[] characters.

  • Exist in the catalog.

If the language is nullNothingnullptra null reference (Nothing in Visual Basic) then the ActiveLanguage will be set to the default language of the catalog. If the language is specified and the language exists in the catalog then the ActiveLanguage will be set to the specified language. If the language is specified and the language does not exist in the catalog then the ActiveLanguage will be set to the default language of the catalog. You should compare the ActiveLanguage property on the returned Category object with the language to see if the Category object was retrieved in the desired language or not. 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