InitImportPromoCodes Method

This method is used to initialize import of promo codes for a discount.

Namespace:  Microsoft.CommerceServer.Marketing.WebService
Assembly:  Microsoft.CommerceServer.Marketing.DataManagement (in Microsoft.CommerceServer.Marketing.DataManagement.dll)

Syntax

'Declaration
<WebMethodAttribute> _
Public Overridable Function InitImportPromoCodes ( _
    promoCodeDefinitionId As Integer, _
    batchName As String, _
    filePath As String, _
    fileSize As Long, _
    fileLastWriteTime As DateTime, _
    codeLength As Integer, _
    prefix As String, _
    suffix As String _
) As UploadHandshake
'Usage
Dim instance As MarketingWebService
Dim promoCodeDefinitionId As Integer
Dim batchName As String
Dim filePath As String
Dim fileSize As Long
Dim fileLastWriteTime As DateTime
Dim codeLength As Integer
Dim prefix As String
Dim suffix As String
Dim returnValue As UploadHandshake

returnValue = instance.InitImportPromoCodes(promoCodeDefinitionId, _
    batchName, filePath, fileSize, fileLastWriteTime, _
    codeLength, prefix, suffix)
[WebMethodAttribute]
public virtual UploadHandshake InitImportPromoCodes(
    int promoCodeDefinitionId,
    string batchName,
    string filePath,
    long fileSize,
    DateTime fileLastWriteTime,
    int codeLength,
    string prefix,
    string suffix
)
[WebMethodAttribute]
public:
virtual UploadHandshake^ InitImportPromoCodes(
    int promoCodeDefinitionId, 
    String^ batchName, 
    String^ filePath, 
    long long fileSize, 
    DateTime fileLastWriteTime, 
    int codeLength, 
    String^ prefix, 
    String^ suffix
)
public function InitImportPromoCodes(
    promoCodeDefinitionId : int, 
    batchName : String, 
    filePath : String, 
    fileSize : long, 
    fileLastWriteTime : DateTime, 
    codeLength : int, 
    prefix : String, 
    suffix : String
) : UploadHandshake

Parameters

  • fileLastWriteTime
    Type: System..::.DateTime
    LastModified time of the file that will be imported.
  • codeLength
    Type: System..::.Int32
    The length of codes to generate for the discount.
  • prefix
    Type: System..::.String
    This string is prepended to the beginning of every generated code.
  • suffix
    Type: System..::.String
    This string is appended to the end of every generated code.

Return Value

Type: Microsoft.CommerceServer..::.UploadHandshake
An UploadHandshake to indicate how the upload handshake should proceed.

Exceptions

Exception Condition
ArgumentOutOfRangeException

The promoCodeDefinitionId provided is not a valid ID value.

ArgumentNullException

The filePath or batchName provided is nullNothingnullptra null reference (Nothing in Visual Basic).

ArgumentException

The filePath provided is not a valid absolute file path.

NotAuthorizedException

The calling user is not authorized to perform this operation.

ImportInProgressException

An import is already in progress for this PromoCodeDefinition.

UploadFileSizeException

The fileSize provided is larger than the configured maximum size allowed.

EntityDoesNotExistException

No PromoCodeDefinition exists with the provided promoCodeDefinitionId value.

StringLengthValidationException

The batchName provided is longer than the maximum allowed batch name length.

DuplicateEntityNameException

A batch record already exists with the provided batchName

ServerFaultException

An unexpected error occurred on the server.

Remarks

The file is uploaded to the server and the server will import the file into the database. The discount must already be associated with a PromoCodeDefinition.

Permissions

See Also

Reference

MarketingWebService Class

MarketingWebService Members

Microsoft.CommerceServer.Marketing.WebService Namespace