Delen via


GetCategory Method (String, CategoryConfiguration)

Retrieves a Category object for the specified category and configuration in the current catalog.

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

Syntax

'Declaration
Public Function GetCategory ( _
    categoryName As String, _
    config As CategoryConfiguration _
) As Category
'Usage
Dim instance As ProductCatalog
Dim categoryName As String
Dim config As CategoryConfiguration
Dim returnValue As Category

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

Parameters

  • categoryName
    Type: System..::.String
    The name of the category. Should not be nullNothingnullptra null reference (Nothing in Visual Basic).

Return Value

Type: Microsoft.CommerceServer.Catalog..::.Category
A Category object that contains information about the category specified by categoryName.

Exceptions

Exception Condition
EntityDoesNotExistException

The categoryName does not exist in the catalog.

NotAuthorizedException

The caller is not authorized to perform this operation.

Remarks

You can use the returned Category object to access and update information about the category. If you make any changes to this object you should call the Save method to save the changes to the catalog system. The categoryName should:

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

  • Not exceed 215 characters.

  • Exist in the current catalog.

For a virtual catalog you should pass the categoryName in the format categoryName(BaseCatalogName) For example if you include a category "Autobiographies" from a "Books" catalog in a virtual catalog named AllBooks then to get the Category object you should use string categoryName = @"Autobiographies(Books)"; Category category =ProductCatalog.GetCategory(categoryName);

Permissions

See Also

Reference

ProductCatalog Class

ProductCatalog Members

GetCategory Overload

Microsoft.CommerceServer.Catalog Namespace