Share via


UpdateProfile Method

Updates a profile on the server.

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

Syntax

'Declaration
Public Function UpdateProfile ( _
    profileXml As XmlElement, _
    forceOverwrite As Boolean _
) As ProfileOperationResponse
'Usage
Dim instance As ProfileManagementContext
Dim profileXml As XmlElement
Dim forceOverwrite As Boolean
Dim returnValue As ProfileOperationResponse

returnValue = instance.UpdateProfile(profileXml, _
    forceOverwrite)
public ProfileOperationResponse UpdateProfile(
    XmlElement profileXml,
    bool forceOverwrite
)
public:
ProfileOperationResponse^ UpdateProfile(
    XmlElement^ profileXml, 
    bool forceOverwrite
)
public function UpdateProfile(
    profileXml : XmlElement, 
    forceOverwrite : boolean
) : ProfileOperationResponse

Parameters

  • forceOverwrite
    Type: System..::.Boolean
    If false, this API will throw an exception when it is detected that the profile being updated has been modified since it was originally retrieved from the web service. If true, no optimistic lock-checking is performed.

Return Value

Type: Microsoft.CommerceServer.Profiles..::.ProfileOperationResponse
An object describing the profile that was updated.

Exceptions

Exception Condition
ArgumentNullException

Any of the parameters provided is nullNothingnullptra null reference (Nothing in Visual Basic).

AuthenticationException

User has not been authenticated.

NotAuthorizedException

User is not authorized to perform this task.

DuplicateKeyValueException

The update violated a unique key constraint.

DefinitionDoesNotExistException

The profile definition named in the profileXml does not exist.

PropertyDoesNotExistException

A profile property named in the profileXml does not exist.

ProfileDoesNotExistException

No profile exists with the provided key value.

OptimisticLockException

An optimistic locking violation has been detected.

XmlException

The profileXml provided is not correctly formatted.

StringLengthValidationException

A string property specified in profileXml is greater than 8,000 characters, or within the constraints specified by the MinLength and MaxLength profile definition custom attribute.

MinimumValueValidationException

A number property specified in profileXml is less than the MinValue constraint specified on the profile definition.

MaximumValueValidationException

A number property specified in profileXml is greater than the MaxValue constraint specified on the profile definition.

PropertyNullValidationException

A required property was not provided in the profileXml.

PropertyTypeValidationException

One of the profile property values provided is not the correct type.

InvalidOperationException

An attempt was made to update a property that has been specified as a JoinKey or KeyIndex.

Remarks

If the primary key of the profile is not specified in the profileXml, an exception will be thrown. The caller should never set the date_last_changed property of the profile. If this property exists, the web service will update it when this method is called. The web service will only do this is the property has the name "date_last_changed" and the propType is DATETIME.

This API will also make optimistic locking checks to prevent changes made by one user from being overwritten by another. 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.

Permissions

See Also

Reference

ProfileManagementContext Class

ProfileManagementContext Members

Microsoft.CommerceServer.Profiles Namespace