Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
For the latest version of Commerce Server 2007 Help, see the Microsoft Web site.
Imports externally generated promocodes with optional target users.
Namespace: Microsoft.CommerceServer.Marketing
Assembly: Microsoft.CommerceServer.Marketing.CrossTierTypes (in Microsoft.CommerceServer.Marketing.CrossTierTypes.dll)
Syntax
'Declaration
Public Function ImportCodes ( _
promoCodeDefinitionId As Integer, _
batchName As String, _
filePath As String _
) As Guid
'Usage
Dim instance As PromoCodeDefinitionManager
Dim promoCodeDefinitionId As Integer
Dim batchName As String
Dim filePath As String
Dim returnValue As Guid
returnValue = instance.ImportCodes(promoCodeDefinitionId, _
batchName, filePath)
public Guid ImportCodes(
int promoCodeDefinitionId,
string batchName,
string filePath
)
public:
Guid ImportCodes(
int promoCodeDefinitionId,
String^ batchName,
String^ filePath
)
public function ImportCodes(
promoCodeDefinitionId : int,
batchName : String,
filePath : String
) : Guid
Parameters
- promoCodeDefinitionId
Type: System..::.Int32
Id of the PromoCodeDefinition to which the promotion codes should be imported.
- batchName
Type: System..::.String
Friendly name that will identify this batch of imported promotion codes.
- filePath
Type: System..::.String
Full path to the file containing the promotion codes and target users to be imported.
Return Value
Type: System..::.Guid
Id of the batch that will contain the promotion codes and target user imported. This value is also known as an import token.
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 promo code definition. |
UploadFileSizeException | The size of the file provided is greater than the configured maximum size allowed. |
EntityDoesNotExistException | No PromoCodeDefinition exists with the provided Id value. |
StringLengthValidationException | The batchName provided is longer than the maximum allowed batch name length. |
DuplicateEntityNameException | A batch record already exists with the provided name |
SecurityException | The caller does not have required permission to the provided file. |
UnauthorizedAccessException | Access to the provided file is denied. |
PathTooLongException | The provided file path exceeds the system-defined maximum length. |
NotSupportedException | The provided file path contains an invalid colon (:) in the middle of the string. |
ServerFaultException | An unexpected error occurred on the server. |
Remarks
The import file can optionally contain users for which the promotion codes are targeted. However, if the PromoCodeDefinition for which the promotion codes are being imported is a Restricted definition, target users must be present in the import file. This method cannot be used to import a file that contains only target users. To do this, the ImportUsersAndGenerateCodes method should be used.
Permissions
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
See Also
Reference
PromoCodeDefinitionManager Class