Condividi tramite


GetProduct Method (String)

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

returnValue = instance.GetProduct(productId)
public Product GetProduct(
    string productId
)
public:
Product^ GetProduct(
    String^ productId
)
public function GetProduct(
    productId : String
) : 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.

Exceptions

Exception Condition
EntityDoesNotExistException

The productId does not exist in the catalog.

NotAuthorizedException

The caller is not authorized to perform this operation.

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