Share via


ProductCatalog3.DeleteCategory Method (PIA)

Use this method to delete a category from the Product Catalog System.

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop.Catalog
…
Public Sub DeleteCategory(strCategoryName As String)

[C#]

using Microsoft.CommerceServer.Interop.Catalog;
…
public void DeleteCategory(stringstrCategoryName);

Parameters

[Visual Basic .NET]

  • strCategoryName
    A String that contains the name of the category to be deleted.

[C#]

  • strCategoryName
    A string that contains the name of the category to be deleted.

Exceptions

This method may throw one of many mapped exceptions or an exception of type COMException. See Standard COM Errors for additional details.

The following table shows the custom COM errors that COMException may wrap as exceptions for this method.

Constant Value Description
E_CAT_INVALID_CATEG_LENGTH

[C#] 0x88980047

[Visual Basic .NET] &H88980047

The category name you specified is either blank or exceeds the maximum allowed length of 128 characters or cannot be converted to a string.
E_CAT_VC_INVALID_PROD_ID_OR_CATEGORY_NAME

[C#] 0x889800FB

[Visual Basic .NET] &H889800FB

The value you specified for the ProductID or CategoryName exceeds the maximum allowed length of 348 characters.
E_CAT_CATEGORY_DOESNT_EXIST

[C#] 0x8898001C

[Visual Basic .NET] &H8898001C

The category you specified does not exist.
E_CAT_VC_CANT_DELETE_INCLUDED_CATEGORY

[C#] 0x88980104

[Visual Basic .NET] &H88980104

The DeleteCategory method cannot be called for a virtual catalog's included categories.
E_CAT_CATEGORY_DOESNT_EXIST

[C#] 0x8898001C

[Visual Basic .NET] &H8898001C

The category you specified does not exist.
E_CAT_VC_ERROR_IN_PROPAGATING_BC_CHANGES

[C#] 0x88980101

[Visual Basic .NET] &H88980101

There was an error in propagating the base catalog changes to the dependent virtual catalogs

Remarks

Any products or categories that existed in the deleted category, but not in another category, will be orphaned. Categories will become root categories and products will become root products. For example: CategoryA and CategoryB are child categories of CategoryX. CategoryA is also a child of CategoryY. When CategoryX is deleted, CategoryB will become a root category, but CategoryA will not.

You cannot delete an inherited category from a virtual catalog. The following error will be returned: E_CAT_VC_CANT_DELETE_INCLUDED_CATEGORY "The DeleteCategory method cannot be called for a virtual catalog's included categories."

If this category has been specified as a Pricing category for a custom catalog, it will be removed as the Pricing category. All the products using this category as a Pricing category will revert to their original price and the category will be removed as the Pricing category

[Visual Basic .NET]

Example

myProductCatalog.DeleteCategory("Apparel")

Requirements

Namespace: Microsoft.CommerceServer.Interop.Catalog

Platforms: Windows 2000, Windows Server 2003

Assembly: cataloglib (in cataloglib.dll)

See Also

ProductCatalog3 Class

ProductCatalog3.RootCategories

ProductCatalog3.CreateCategory

ProductCatalog3.GetCategory

Copyright © 2005 Microsoft Corporation.
All rights reserved.