IProductCatalog3::GetProduct Method [C++]

Use this method to retrieve the specified product from a catalog.

Definition

[C++]

HRESULT IProductCatalog3::GetProduct(VARIANTvarProductID,
 IProduct3**ppProduct);

[Visual Basic]

Function GetProduct(varProductID As Variant) As Product

Parameters

  • varProductID[C++]
    [in] A VARIANT that contains the unique identifier of the product.
  • varProductID[Visual Basic]
    A Variant that contains the unique identifier of the product.
  • ppProduct[C++]
    [out, retval] A pointer to a Product object used to return the specified product.

Return Values

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

[Visual Basic] If this method completes successfully, it returns the product specified.

Error Values

[C++] This method returns S_OK (0x00000000) or S_FALSE (&H00000001) to indicate success and standard COM HRESULT error values, to indicate failure. This method may succeed and yet not return a valid output parameter. The output parameter(s) will be invalid if either and error value or S_FALSE is returned. 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) or S_FALSE (&H00000001) to indicate success and to either standard or custom COM error values to indicate failure. This method may succeed and yet return a property or object that is Nothing due to a syntax error, such as requesting a property or object that does not exist. Test the return value for Nothing before relying on it. For more information about standard COM errors, see Standard COM Errors.

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

Constant Value Description
E_POINTER

[C++] 0x80004003

[Visual Basic] &H80004003

The pointer is invalid..
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_INVALID_PARAMETER

[C++] 0x889800B6

[Visual Basic] &H889800B6

The input parameter <parameter number> is invalid.
S_FALSE 1 The product does not exist.

[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

[C++] The ppProduct parameter contains valid data only if the method completed successfully.

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

[Visual Basic]

Example

SET oMyProduct = myProductCatalog.GetProduct("SKU4005")
' for virtual catalogs
SET oMyProduct = myVirtualCatalog.GetProduct "SKU001(MyBaseCatalog)"

See Also

[C++]ProductCatalog Object

[Visual Basic]ProductCatalog Object

[C++]IProductCatalog3::CreateProduct

[Visual Basic]ProductCatalog.CreateProduct

[C++]IProductCatalog3::DeleteProduct

[Visual Basic]ProductCatalog.DeleteProduct

Copyright © 2005 Microsoft Corporation.
All rights reserved.