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.
Imports target users and generates a new promocode for each of them.
Namespace: Microsoft.CommerceServer.Marketing
Assembly: Microsoft.CommerceServer.Marketing.CrossTierTypes (in Microsoft.CommerceServer.Marketing.CrossTierTypes.dll)
Syntax
'Declaration
Public Function ImportUsersAndGenerateCodes ( _
promoCodeDefinitionId As Integer, _
batchName As String, _
filePath As String, _
generationParameters As RandomGenerationParameters _
) As Guid
'Usage
Dim instance As PromoCodeDefinitionManager
Dim promoCodeDefinitionId As Integer
Dim batchName As String
Dim filePath As String
Dim generationParameters As RandomGenerationParameters
Dim returnValue As Guid
returnValue = instance.ImportUsersAndGenerateCodes(promoCodeDefinitionId, _
batchName, filePath, generationParameters)
public Guid ImportUsersAndGenerateCodes(
int promoCodeDefinitionId,
string batchName,
string filePath,
RandomGenerationParameters generationParameters
)
public:
Guid ImportUsersAndGenerateCodes(
int promoCodeDefinitionId,
String^ batchName,
String^ filePath,
RandomGenerationParameters^ generationParameters
)
public function ImportUsersAndGenerateCodes(
promoCodeDefinitionId : int,
batchName : String,
filePath : String,
generationParameters : RandomGenerationParameters
) : Guid
Parameters
- promoCodeDefinitionId
Type: System..::.Int32
Id of the PromoCodeDefinition to which the target users should be imported.
- batchName
Type: System..::.String
Friendly name that will identify this batch of imported target users and promotion codes.
- filePath
Type: System..::.String
Full path to the file containing the target users to be imported.
- generationParameters
Type: Microsoft.CommerceServer.Marketing..::.RandomGenerationParameters
A RandomGenerationParameters object that specifies how the promotion codes should be generated for each target user 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, batchName, or generationParameters 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 PromoCodeDefinition with the id specified by promoCodeDefinitionId must be a Private or Restricted definition. Promotion codes cannot be imported for a Public definition.
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