Share via


GetVariant Method (String, String, VariantConfiguration)

Retrieves a Variant object for the specified product, variant and configuration in the current catalog.

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

Syntax

'Declaration
Public Function GetVariant ( _
    productId As String, _
    variantId As String, _
    config As VariantConfiguration _
) As Variant
'Usage
Dim instance As ProductCatalog
Dim productId As String
Dim variantId As String
Dim config As VariantConfiguration
Dim returnValue As Variant

returnValue = instance.GetVariant(productId, _
    variantId, config)
public Variant GetVariant(
    string productId,
    string variantId,
    VariantConfiguration config
)
public:
Variant^ GetVariant(
    String^ productId, 
    String^ variantId, 
    VariantConfiguration^ config
)
public function GetVariant(
    productId : String, 
    variantId : String, 
    config : VariantConfiguration
) : Variant

Parameters

  • productId
    Type: System..::.String
    Identifier of the product family for the variant to return. Should not be nullNothingnullptra null reference (Nothing in Visual Basic).
  • variantId
    Type: System..::.String
    Identifier of the variant to return. Should not be nullNothingnullptra null reference (Nothing in Visual Basic).

Return Value

Type: Microsoft.CommerceServer.Catalog..::.Variant
A Variant object that contains information about the product variant specified by productId and variantId.

Exceptions

Exception Condition
EntityDoesNotExistException

The variant does not exist in the product family.

NotAuthorizedException

The caller is not authorized to perform this operation.

Remarks

You can use the returned Variant object to access and update information about the product variant.

The productId and productId should:

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

  • Not exceed 343 characters.

  • Exist in the current catalog.

For a virtual catalog you should pass the productId in the format productId(BaseCatalogName) and the variantId in the format variantId(BaseCatalogName) For example if you include a product "Book" from a "Books" catalog in a virtual catalog named AllBooks then to get the Product object you should use string productId = @"Book(Books)"; Product product =ProductCatalog.GetProduct(productId);

Permissions

See Also

Reference

ProductCatalog Class

ProductCatalog Members

GetVariant Overload

Microsoft.CommerceServer.Catalog Namespace