AddParentCategory Method
Adds a category as a parent category of this category.
Namespace: Microsoft.CommerceServer.Catalog
Assembly: Microsoft.CommerceServer.Catalog (in Microsoft.CommerceServer.Catalog.dll)
Syntax
'Declaration
Public Sub AddParentCategory ( _
categoryName As String _
)
'Usage
Dim instance As CatalogItem
Dim categoryName As String
instance.AddParentCategory(categoryName)
public void AddParentCategory(
string categoryName
)
public:
void AddParentCategory(
String^ categoryName
)
public function AddParentCategory(
categoryName : String
)
Parameters
- categoryName
Type: System..::.String
The category to add as a parent category.
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | The categoryName is nullNothingnullptra null reference (Nothing in Visual Basic). |
ValidationException | The categoryName is invalid or you are attempting to add a parent category as a root category. |
EntityAlreadyExistsException | The category already exists as a parent category. |
Remarks
You cannot add a parent category to a root category.
This method adds the category to this category as a parent category. The categoryName should:
Not be nullNothingnullptra null reference (Nothing in Visual Basic) or blank.
Not exceed 215 characters.
Exist in the catalog.
Not already exist as a child category or parent category for this category.
If this category is in a virtual catalog and you want to add a category from one of the included base catalogs 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 add the category you should use string categoryName = @"Autobiographies(Books)"; category.AddParentCategory(categoryName); You should call the Save method to save the changes to the catalog system. The catalog system will not check for circular dependencies. It is the responsibility of the application developer to ensure that there are no circular dependencies.
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.