Share via


Save Method

Saves changes made to the current Advertisement object.

Namespace:  Microsoft.CommerceServer.Marketing
Assembly:  Microsoft.CommerceServer.Marketing.CrossTierTypes (in Microsoft.CommerceServer.Marketing.CrossTierTypes.dll)

Syntax

'Declaration
Public Overrides Sub Save ( _
    forceOverwrite As Boolean _
)
'Usage
Dim instance As Advertisement
Dim forceOverwrite As Boolean

instance.Save(forceOverwrite)
public override void Save(
    bool forceOverwrite
)
public:
virtual void Save(
    bool forceOverwrite
) override
public override function Save(
    forceOverwrite : boolean
)

Parameters

  • forceOverwrite
    Type: System..::.Boolean
    Controls optimistic locking behavior. If the value is false and the record was modified in the database after it was loaded for editing, then an exception is raised.

Exceptions

Exception Condition
ArgumentNullException

The xml serializable data received at the web service was nullNothingnullptra null reference (Nothing in Visual Basic).

ArgumentOutOfRangeException

The Id of the CampaignItem is less than zero.

NotAuthorizedException

The user is not authorized to perform the requested updates.

EntityDoesNotExistException

The ItemType is not a recognized campaign item type.

EntityStateException

The Advertisement cannot be modified because it has been deleted.

DuplicateEntityNameException

A campaign item with the specified Name already exists with in the context of the Campaign specified by CampaignName.

EnumeratedValueValidationException

An enumeration value of the Advertisement is not valid.

MaximumValueValidationException

One or more of the numeric property values of the current object was set to a value greater than the maximum allowed.

MinimumValueValidationException

One or more of the numeric property values of the current object was set to a value less than the minimum allowed.

OptimisticLockException

LastModifiedDate of the object was not set or the record was modified in the database since being loaded for editing. This exception is raised only if forceOverwrite is set to false

InvalidOperationException

An attempt was made to update the Active status of an existing Advertisement through the Save API. To update this status, please use Activate or Deactivate.

Remarks

Saves changes to the database. Upon completion sets the HasChanges property to false.

Use forceOverwrite to prevent overwriting the object in the database. This will raise an exception if set to false and the record was modified in the database after it was loaded for editing.

Save can be used to add a new Advertisement to the database or update an existing Advertisement in the database.

Permissions

See Also

Reference

Advertisement Class

Advertisement Members

Microsoft.CommerceServer.Marketing Namespace