Partilhar via


GetProduct Method (String, ProductConfiguration)

Retrieves a Product object for the specified product and configuration in the current catalog.

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

Syntax

'Declaration
Public Function GetProduct ( _
    productId As String, _
    config As ProductConfiguration _
) As Product
'Usage
Dim instance As ProductCatalog
Dim productId As String
Dim config As ProductConfiguration
Dim returnValue As Product

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

Parameters

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

Return Value

Type: Microsoft.CommerceServer.Catalog..::.Product
A Product object that contains information about the product specified by productId.

Remarks

You can use the returned Product object to access and update information about the product. If you make any changes to this object you should call the Save method to save the changes to the catalog system.

The 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) 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

GetProduct Overload

Microsoft.CommerceServer.Catalog Namespace