Partager via


GetProduct Method (String, String, String)

Retrieves a Product object containing information about the product.

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

Syntax

'Declaration
Public Function GetProduct ( _
    catalogName As String, _
    productId As String, _
    language As String _
) As Product
'Usage
Dim instance As CatalogContext
Dim catalogName As String
Dim productId As String
Dim language As String
Dim returnValue As Product

returnValue = instance.GetProduct(catalogName, _
    productId, language)
public Product GetProduct(
    string catalogName,
    string productId,
    string language
)
public:
Product^ GetProduct(
    String^ catalogName, 
    String^ productId, 
    String^ language
)
public function GetProduct(
    catalogName : String, 
    productId : String, 
    language : String
) : Product

Parameters

  • catalogName
    Type: System..::.String
    The name of the catalog. May not be nullNothingnullptra null reference (Nothing in Visual Basic).
  • productId
    Type: System..::.String
    The product identifier of the product to return. Should not be nullNothingnullptra null reference (Nothing in Visual Basic).
  • language
    Type: System..::.String
    The culture code indicating the language that is associated with the Catalog.

Return Value

Type: Microsoft.CommerceServer.Catalog..::.Product
A Product object containing information about the product.

Exceptions

Exception Condition
ArgumentNullException

The catalogName,productId, or language is nullNothingnullptra null reference (Nothing in Visual Basic).

ValidationException

One of the input parameters is invalid.

EntityDoesNotExistException

The productId does not exist in the catalog.

NotAuthorizedException

The caller is not authorized to perform this operation.

Remarks

The returned Product object contains multilingual information in the language specified by the language. You can use the returned Product object to access and update information about the product. If you make any changes to the returned Product object you should call the Save method to save the changes to the catalog system.

The catalogName should:

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

  • Not exceed 85 characters.

  • Not contain the .,"[]'()# characters.

  • Exist in the catalog system.

The productId should:

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

  • Not exceed 343 characters.

  • Already exist in the catalog.

If specified the language should:

  • Not exceed 10 characters.

  • Not contain the ,'[] characters.

  • Exist in the catalog.

If the language is nullNothingnullptra null reference (Nothing in Visual Basic) then the ActiveLanguage will be set to the default language of the catalog. If the language is specified and the language exists in the catalog then the ActiveLanguage will be set to the specified language. If the language is specified and the language does not exist in the catalog then the ActiveLanguage will be set to the default language of the catalog. You should compare the ActiveLanguage property on the returned Product object with the language to see if the Product object was retrieved in the desired language or not.

Permissions

See Also

Reference

CatalogContext Class

CatalogContext Members

GetProduct Overload

Microsoft.CommerceServer.Catalog Namespace