Partager via


AddVariant Method

Adds the variantId to the product.

Namespace:  Microsoft.CommerceServer.Catalog
Assembly:  Microsoft.CommerceServer.Catalog (in Microsoft.CommerceServer.Catalog.dll)

Syntax

'Declaration
Public Sub AddVariant ( _
    variantId As String _
)
'Usage
Dim instance As ProductFamily
Dim variantId As String

instance.AddVariant(variantId)
public void AddVariant(
    string variantId
)
public:
void AddVariant(
    String^ variantId
)
public function AddVariant(
    variantId : String
)

Parameters

Exceptions

Exception Condition
ValidationException

The variantId is invalid.

Remarks

This method adds a variant to the product family. The variantId is used to uniquely identify a variant in a product family. A variant can be added only if the catalog has a IdentifyingVariantProperty defined for it when the catalog was created and the current product is a ProductFamilyClass.

The variantId should:

  • Not be nullNothingnullptra null reference (Nothing in Visual Basic) or blank.

  • Not exceed 256 characters.

  • Not already exist in the product family.

You should call the Save method to save the changes to the catalog system. The new variant will inherit the values for the normal properties in the definition from the product definition.

Permissions

See Also

Reference

ProductFamily Class

ProductFamily Members

Microsoft.CommerceServer.Catalog Namespace