ProductCatalog3.CreateProduct Method (PIA)
Use this method to create a new product within the catalog according to specified parameters.
Definition
[Visual Basic .NET]
Imports Microsoft.CommerceServer.Interop.Catalog
…
Public Function CreateProduct(strDefinitionName As String,
varProductID As Object,
cyListPrice As Decimal,
Optional strParentCategoryName As Object) As IProduct
[C#]
using Microsoft.CommerceServer.Interop.Catalog;
…
public IProduct CreateProduct(stringstrDefinitionName,
object varProductID,
decimalcyListPrice,
object strParentCategoryName);
Parameters
[Visual Basic .NET]
- strDefinitionName
A String that contains the name of the product definition for the product. - varProductID
An Object that contains the unique product ID for the product to be created. The data type must match the property used to uniquely identify products in this catalog. - cyListPrice
A Decimal value that contains the list price of the product to be created. - strParentCategoryName
An Object that contains the name of the category to be designated as the parent category of the product to be created.
[C#]
- strDefinitionName
A string that contains the name of the product definition for the product. - varProductID
An object that contains the unique product ID for the product to be created. The data type must match the property used to uniquely identify products in this catalog. - cyListPrice
A decimal that contains the list price of the product to be created. - strParentCategoryName
An object that contains the name of the category to be designated as the parent category of the product to be created. Set to Type.Missing to indicate no parent category.
Return Values
[Visual Basic .NET] If this method completes successfully, it returns the IProduct interface to the Product object that was created.
[C#] This method returns a Product object used to return the properties of the newly created product.
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_VC_NOT_A_SUPPLIER_CATALOG | [C#] 0x889800F9 [Visual Basic .NET] &Hx889800F9 |
Invalid catalog type. This API can only be called on a base catalog. |
E_POINTER | [C#] 0x80004003 [Visual Basic .NET] &H80004003 |
The pointer is invalid. |
E_CAT_INVALID_DEFINITION_LENGTH | [C#] 0x889800EA [Visual Basic .NET] &Hx889800EA |
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_PRODUCTID | [C#] 0x8898005B [Visual Basic .NET] &H8898005B |
The value you specified for the ProductID is blank or exceeds the maximum allowed length of 256 characters. |
E_CAT_INVALIDVALUE_FOR_PRODUCTID | [C#] 0x8898004E [Visual Basic .NET] &Hx8898004E |
The value you specified for the ProductID is either out of range or does not satisfy the Min/Max condition. |
E_CAT_VC_INVALID_PROD_ID_OR_CATEGORY_NAME | [C#] 0x889800FB [Visual Basic .NET] &Hx889800FB |
The value you specified for the ProductID or CategoryName exceeds the maximum allowed length of 348 characters. |
E_CAT_INVALID_CATEG_LENGTH | [C#] 0x88980047 [Visual Basic .NET] &Hx88980047 |
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_CATEGORY_DEFN_FOR_PRODUCT | [C#] 0x8898004A [Visual Basic .NET] &H8898004A |
The definition name that you specified is a category definition. This definition cannot be used to create the product. |
E_CAT_INVALID_PRODUCT_DEFINITION | [C#] 0x8898005F [Visual Basic .NET] &Hx8898005F |
The product definition you specified contains a variant property that is being used as the ProductID for this catalog. |
E_CAT_PRODUCT_EXISTS | [C#] 0x8898001B [Visual Basic .NET] &Hx8898001B |
The product you specified already exists. |
E_CAT_CATEGORY_DOESNT_EXIST | [C#] 0x8898001C [Visual Basic .NET] &Hx8898001C |
The category you specified does not exist. |
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. |
Remarks
A product family is a product that has variants.
The properties of the definition on which a new product is based will determine whether the product being created is a single product or a product family. If the definition used to create the product has variant properties, the newly created product will be a product family.
[Visual Basic .NET]
Example
oMyNewProduct = myProductCatalog.CreateProduct("BasicProduct", "SKU3004", cyListPrice, "Apparel")
Requirements
Namespace: Microsoft.CommerceServer.Interop.Catalog
Platforms: Windows 2000, Windows Server 2003
Assembly: cataloglib (in cataloglib.dll)
See Also
Copyright © 2005 Microsoft Corporation.
All rights reserved.