ICategory3::AddProduct Method [C++]

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

Definition

[C++]

HRESULT ICategory3::AddProduct(VARIANTvarProductID);

[Visual Basic]

Sub AddProduct(varProductID As Variant)

Parameters

  • varProductID[C++]
    [in] A VARIANT that contains the product ID of the product to be added.
  • varProductID[Visual Basic]
    A Variant that contains the product ID of the product to be added.

Return Values

[C++] This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.

[Visual Basic] None.

Error Values

[C++] This method returns S_OK (0x00000000) to indicate success and either standard or custom COM HRESULT error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.

[Visual Basic] This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to either standard or custom COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors.

The following table shows the custom COM errors that this method can return.

Constant Value Description
E_CAT_INVALID_OPERATION_FOR_ROOT_CATEGORY

[C++] 0x889800F8

[Visual Basic] &H889800F8

This API cannot be called for a root category.
E_CAT_INVALID_PRODUCTID

[C++] 0x8898005B

[Visual Basic] &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] &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] &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] &H8898001E

The product you specified doesn't exist.
E_CAT_PRODUCT_ALREADY_ADDED

[C++] 0x88980029

[Visual Basic] &H88980029

The product you specified is already present in this category.

[C++] Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.

[Visual Basic] Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

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

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

[Visual Basic]

Example

myCategory.AddProduct "SKU4005"

See Also

[C++]Category Object

[C++]ICategory3::RemoveProduct

[Visual Basic]Category Object

[Visual Basic]Category.RemoveProduct

Copyright © 2005 Microsoft Corporation.
All rights reserved.