CreateCopy Method
Creates a copy of an existing campaign item.
Namespace: Microsoft.CommerceServer.Marketing
Assembly: Microsoft.CommerceServer.Marketing.CrossTierTypes (in Microsoft.CommerceServer.Marketing.CrossTierTypes.dll)
Syntax
'Declaration
Public Function CreateCopy ( _
campaignItemId As Integer, _
newParentCampaignId As Integer _
) As CampaignItem
'Usage
Dim instance As CampaignItemManager
Dim campaignItemId As Integer
Dim newParentCampaignId As Integer
Dim returnValue As CampaignItem
returnValue = instance.CreateCopy(campaignItemId, _
newParentCampaignId)
public CampaignItem CreateCopy(
int campaignItemId,
int newParentCampaignId
)
public:
CampaignItem^ CreateCopy(
int campaignItemId,
int newParentCampaignId
)
public function CreateCopy(
campaignItemId : int,
newParentCampaignId : int
) : CampaignItem
Parameters
- campaignItemId
Type: System..::.Int32
The Id of the source CampaignItem to be copied.
- newParentCampaignId
Type: System..::.Int32
The Id of the parent campaign for the new CampaignItem. Passing zero indicates that the parent campaign for the new CampaignItem should be the same as the parent campaign for the source CampaignItem.
Return Value
Type: Microsoft.CommerceServer.Marketing..::.CampaignItem
The newly created CampaignItem.
Exceptions
Exception | Condition |
---|---|
ArgumentOutOfRangeException | newParentCampaignId was less than one. |
ArgumentException | The CampaignItem retrieved is not a DiscountData object. Currently only objects with this type is supported. |
EntityDoesNotExistException | The parent Campaign denoted by newParentCampaignId does not exist. |
EntityStateException | The new parent campaign with Id campaignItemId has been deleted. |
Remarks
Creates a new campaign item that is a copy of an existing campaign item. The new CampaignItem is not saved to persistent storage until the Save is called. CreateCopy makes a copy of the source CampaignItem but does not save it to persistent storage. After setting required properties on the new item such as Name, the CampaignItem must be saved to persistent storage using the Save. The following properties of the source CampaignItem are not copied: Name, Active, CreatedDate, LastModifiedDate, LastModifiedBy. For Discount campaign items, the Priority property is not copied and will be returned as zero. Prioritization of discounts must be done as a second step after saving a Discount by using either the PrioritizeDiscount method or the UpdateDiscountPriorities method.
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.