ProductCatalog3.CreateCategory Method (PIA)
Use this method to create a new category.
Definition
[Visual Basic .NET]
Imports Microsoft.CommerceServer.Interop.Catalog
…
Public Function CreateCategory(strDefinitioName As String,
strCategoryName As String,
Optional strParentCategoryName As Object,
Optional fIsSpecificationSearchable As Object) As Category
[C#]
using Microsoft.CommerceServer.Interop.Catalog;
…
public ICategory CreateCategory(stringstrDefinitioName,
stringstrCategoryName,
object strParentCategoryName,
object fIsSpecificationSearchable);
Parameters
[Visual Basic .NET]
- strDefinitioName
A String that contains the name of the category definition on which the category is based. - strCategoryName
A String that contains the name of the category to be created. - strParentCategoryName
An Object that contains the name of the category that will be a parent to this new category, if any. - fIsSpecificationSearchable
An Object that determines whether or not this category is to be specification searchable.
[C#]
- strDefinitioName
A string that contains the name of the category definition on which the category is based. - strCategoryName
A string that contains the name of the category to be created. - strParentCategoryName
An object that contains the name of the category that will be a parent to this new category, if any. Set to Type.Missing to indicate no parent category. - IsSpecificationSearchable
An object that determines whether or not this category is to be specification searchable. Set to Type.Missing to indicate the default.
Return Values
[Visual Basic .NET] If this method completes successfully, it returns the newly created Category object.
[C#] This method returns an ICategory interface to the newly created catalog object.
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_POINTER | [C#] 0x80004003 [Visual Basic .NET] &H80004003 |
The pointer is invalid. |
E_CAT_INVALID_DEFINITION_LENGTH | [C#] 0x889800EA [Visual Basic .NET] &H889800EA |
The definition name that you specified is invalid. Definition names should be between 1 and 128 characters in length. |
E_CAT_INVALID_PARAMETER | [C#] 0x889800B6 [Visual Basic .NET] &H889800B6 |
The input parameter <parameter number> is invalid. |
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_DEFINITION_DOESNT_EXIST | [C#] 0x8898000B [Visual Basic .NET] &H8898000B |
The definition you specified does not exist. |
E_CAT_PRODUCT_DEFN_FOR_CATEGORY | [C#] 0x8898004B [Visual Basic .NET] &H8898004B |
The definition name that you specified is a product definition. This definition cannot be used to create the category. |
E_CAT_CATEGORY_DOESNT_EXIST | [C#] 0x8898001C [Visual Basic .NET] &H8898001C |
The category you specified does not exist. |
E_CAT_CATEGORY_EXISTS | [C#] 0x8898001D [Visual Basic .NET] &H8898001D |
The category you specified already exists. |
E_CAT_CHARACTER_NOT_ALLOWED | [C#] 0x8898003D [Visual Basic .NET] &H8898003D |
The catalog name you specified has one of the nine reserved characters " [ ] , ' ( )#. that should not be used. |
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. |
[Visual Basic .NET]
Example
oMyCategory = myProductCatalog.CreateCategory("BasicCategoryDefinition", "T-Shirts", "Apparel", True)
Requirements
Namespace: Microsoft.CommerceServer.Interop.Catalog
Platforms: Windows 2000, Windows Server 2003
Assembly: cataloglib (in cataloglib.dll)
See Also
ProductCatalog3.DeleteCategory
Copyright © 2005 Microsoft Corporation.
All rights reserved.