GetCategory Method (String)
Retrieves a Category object for the specified category 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 _
) As Category
'Usage
Dim instance As ProductCatalog
Dim categoryName As String
Dim returnValue As Category
returnValue = instance.GetCategory(categoryName)
public Category GetCategory(
string categoryName
)
public:
Category^ GetCategory(
String^ categoryName
)
public function GetCategory(
categoryName : String
) : 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
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.