RemoveProduct Method

Removes the product as a child of the current category.

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

Syntax

'Declaration
Public Sub RemoveProduct ( _
    productId As String _
)
'Usage
Dim instance As StaticCategory
Dim productId As String

instance.RemoveProduct(productId)
public void RemoveProduct(
    string productId
)
public:
void RemoveProduct(
    String^ productId
)
public function RemoveProduct(
    productId : String
)

Parameters

Exceptions

Exception Condition
ArgumentNullException

The productId is nullNothingnullptra null reference (Nothing in Visual Basic).

ValidationException

The category is a root category.

EntityDoesNotExistException

The productId does not exist in the category.

Remarks

This method removes the productId from the current category. The productId should:

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

  • Not exceed 343 characters.

  • Exist in the catalog.

  • Not already exist as a child product for this category.

If this category is in a virtual catalog and you want to remove a product from one of the included base catalogs you should pass the productId in the format productId(BaseCatalogName) For example if you include a product "Book" from a "Books" catalog in a virtual catalog named AllBooks then to remove the product you should use string productId = @"Book(Books)"; category.RemoveProduct(productId); You should call the Save method to save the changes to the catalog system.

Permissions

See Also

Reference

StaticCategory Class

StaticCategory Members

Microsoft.CommerceServer.Catalog Namespace