GetVariant Method (String, String)

Retrieves a Variant object for the specified product and variant 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 _
) As Variant
'Usage
Dim instance As ProductCatalog
Dim productId As String
Dim variantId As String
Dim returnValue As Variant

returnValue = instance.GetVariant(productId, _
    variantId)
public Variant GetVariant(
    string productId,
    string variantId
)
public:
Variant^ GetVariant(
    String^ productId, 
    String^ variantId
)
public function GetVariant(
    productId : String, 
    variantId : String
) : 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