Share via


Category3.AddProduct Method (PIA)

Use this method to add the specified product to this category.

Definition

[Visual Basic .NET]

Imports Microsoft.CommerceServer.Interop.Catalog
…
Public Sub AddProduct(varProductID As Object)

[C#]

using Microsoft.CommerceServer.Interop.Catalog;
…
public void AddProduct(objectvarProductID);

Parameters

[Visual Basic .NET]

  • varProductID
    An Object that contains the product to be added.

[C#]

  • varProductID
    An object that contains the product to be added.

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 a COMException can wrap.

Constant Value Description
E_CAT_INVALID_OPERATION_FOR_ROOT_CATEGORY

[C#] 0x889800F8

[Visual Basic .NET] &H889800F8

This API cannot be called for a root category.
E_CAT_INVALID_PRODUCTID

[C#] 0x8898005B

[Visual Basic .NET] &H8898005B

The value you specified for the ProductID is blank or else it exceeds the maximum allowed length of 256 characters.
E_CAT_INVALIDVALUE_FOR_PRODUCTID

[C#] 0x8898004E

[Visual Basic .NET] &H8898004E

The value you specified for the ProductID is either out of range or else it does not satisfy the Min/Max condition.
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_PRODUCT_DOESNT_EXIST

[C#] 0x8898001E

[Visual Basic .NET] &H8898001E

The product you specified doesn't exist.
E_CAT_PRODUCT_ALREADY_ADDED

[C#] 0x88980029

[Visual Basic .NET] &H88980029

The product you specified is already present in this category.

Remarks

A product may exist in multiple categories simultaneously, without limit.

[Visual Basic .NET]

Example

myCategory.AddProduct("SKU4005")

Requirements

Namespace: Microsoft.CommerceServer.Interop.Catalog

Platforms: Windows 2000, Windows Server 2003

Assembly: cataloglib (in cataloglib.dll)

See Also

Category3 Object

Category3.RemoveProduct

Copyright © 2005 Microsoft Corporation.
All rights reserved.