Share via


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

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

See Also

Reference

CampaignItemManager Class

CampaignItemManager Members

Microsoft.CommerceServer.Marketing Namespace