Partager via


LookupPromoCodeDefinitionByCode Method

Returns the PromoCodeDefinition object that corresponds to the specified promotion code.

Namespace:  Microsoft.CommerceServer.Marketing
Assembly:  Microsoft.CommerceServer.Marketing.CrossTierTypes (in Microsoft.CommerceServer.Marketing.CrossTierTypes.dll)

Syntax

'Declaration
Public Function LookupPromoCodeDefinitionByCode ( _
    promoCode As String _
) As PromoCodeDefinition
'Usage
Dim instance As PromoCodeDefinitionManager
Dim promoCode As String
Dim returnValue As PromoCodeDefinition

returnValue = instance.LookupPromoCodeDefinitionByCode(promoCode)
public PromoCodeDefinition LookupPromoCodeDefinitionByCode(
    string promoCode
)
public:
PromoCodeDefinition^ LookupPromoCodeDefinitionByCode(
    String^ promoCode
)
public function LookupPromoCodeDefinitionByCode(
    promoCode : String
) : PromoCodeDefinition

Parameters

  • promoCode
    Type: System..::.String
    A string containing the promotion code to look up.

Return Value

Type: Microsoft.CommerceServer.Marketing..::.PromoCodeDefinition
The PromoCodeDefinition object or nullNothingnullptra null reference (Nothing in Visual Basic) if it does not exist.

Exceptions

Exception Condition
ArgumentNullException

The promoCode argument was nullNothingnullptra null reference (Nothing in Visual Basic).

NotAuthorizedException

The user is not authorized to perform this operation.

Remarks

Given a promotion code, this method will return the corresponding PromoCodeDefinition object that defines the promotion

This method does not throw an exception if the promotion code is not recognized, instead it returns nullNothingnullptra null reference (Nothing in Visual Basic) for codes that are not found.

Permissions

See Also

Reference

PromoCodeDefinitionManager Class

PromoCodeDefinitionManager Members

Microsoft.CommerceServer.Marketing Namespace