Share via


GetBasket Method (Guid, String)

Returns an existing Basket using the specified customer identifier and basket name, or creates a new one if none already exist.

Namespace:  Microsoft.CommerceServer.Runtime.Orders
Assembly:  Microsoft.CommerceServer.Runtime (in Microsoft.CommerceServer.Runtime.dll)

Syntax

'Declaration
Public Function GetBasket ( _
    userId As Guid, _
    basketName As String _
) As Basket
'Usage
Dim instance As OrderContext
Dim userId As Guid
Dim basketName As String
Dim returnValue As Basket

returnValue = instance.GetBasket(userId, _
    basketName)
public Basket GetBasket(
    Guid userId,
    string basketName
)
public:
Basket^ GetBasket(
    Guid userId, 
    String^ basketName
)
public function GetBasket(
    userId : Guid, 
    basketName : String
) : Basket

Parameters

  • userId
    Type: System..::.Guid
    The identifier of the customer owning the basket.
  • basketName
    Type: System..::.String
    The name of the basket. Cannot be nullNothingnullptra null reference (Nothing in Visual Basic).

Return Value

Type: Microsoft.CommerceServer.Runtime.Orders..::.Basket
The existing populated Basket instance, or a new empty basket instance, if one is not found.

Exceptions

Exception Condition
ConfiguredLimitExceededException

Creating a new basket would exceed the maximum allowable number of baskets per customer specified in the Web.config file.

ArgumentException

The specified userId is empty.

ArgumentNullException

The specified basketName is nullNothingnullptra null reference (Nothing in Visual Basic).

Remarks

Use this method to retrieve a Basket meeting the specified criteria, the identifier of the customer and the basket name. If no Basket currently exists, one is created.

Permissions

See Also

Reference

OrderContext Class

OrderContext Members

GetBasket Overload

Microsoft.CommerceServer.Runtime.Orders Namespace