ConstraintConflictResolutionAction Enumeration

Represents actions that are taken to resolve a specific constraint conflict.

Namespace: Microsoft.Synchronization
Assembly: Microsoft.Synchronization (in microsoft.synchronization.dll)

Syntax

'Declaration
Public Enumeration ConstraintConflictResolutionAction
'Usage
Dim instance As ConstraintConflictResolutionAction
public enum ConstraintConflictResolutionAction
public enum class ConstraintConflictResolutionAction
public enum ConstraintConflictResolutionAction
public enum ConstraintConflictResolutionAction

Members

  Member name Description
DestinationWins The change made on the destination replica always wins. The change applier passes the source change to the SaveItemChange method and specifies a save action of DeleteAndStoreTombstone. The destination provider creates a tombstone for the source change. When the destination acts as the source in a later synchronization, it will enumerate a change that represents the deletion of the source item, and so remove it from the synchronization community. 
Merge The data from the source item is combined with the destination item. The change applier passes the source replica's change data to the SaveItemChange method and specifies a save action of ChangeIdUpdateVersionAndMergeData. For details, see the Merging Conflicting Items section of Detecting and Resolving Constraint Conflicts
RenameDestination The conflicting item on the destination replica is renamed so that it no longer collides with the change sent from the source provider, and the source change is applied to the destination replica. The change applier passes the change to the SaveItemChange method and specifies a save action of RenameDestinationAndUpdateVersionData
RenameSource The change sent from the source provider is renamed so that it no longer collides with the conflicting item on the destination replica, and the source change is applied to the destination replica. The change applier passes the change to the SaveItemChange method and specifies a save action of RenameSourceAndUpdateVersionAndData
SaveConflict Log the conflict and do not apply the change. The change applier passes the conflict data to the SaveConstraintConflict method, which saves the conflict in a conflict log. For more information on logging conflicts, see Logging and Managing Conflicts
SkipChange Ignore the conflict and do not apply the change. The change applier does not pass the conflict data to the destination provider. 
SourceWins The change made on the source replica always wins. The change applier passes the change to the SaveItemChange method and specifies a save action of DeleteConflictingAndSaveSourceItem. The source change is applied to the destination replica and the conflicting destination item is deleted from the destination replica. 

Remarks

The members of ConstraintConflictResolutionAction specify the action that the change applier takes to resolve constraint conflicts. Constraint conflicts are conflicts that violate constraints that are put on items or change units, such as the relationship of folders or the location of identically named data within a file system. When a collision conflict resolution policy is specified, the constraint conflict resolution action is specified by the change applier when a collision constraint conflict occurs. Otherwise, the constraint conflict resolution action is specified by the synchronization application when it is notified that a constraint conflict has occurred.

For more information on constraint conflicts, see Detecting and Resolving Constraint Conflicts.

Example

The following example implements a handler for the ItemConstraint event. The handler displays the conflicting items to the user and sets the constraint conflict resolution action based on the user's response.

Private Sub HandleItemConstraint(ByVal sender As [Object], ByVal args As ItemConstraintEventArgs)
    If ConstraintConflictReason.Collision = args.ConstraintConflictReason Then
        ' Display the two items that are in conflict and solicit a resolution from the user.
        Dim srcContact As New Contact(DirectCast(args.SourceChangeData, String()))
        Dim destContact As New Contact(DirectCast(args.DestinationChangeData, String()))
        Dim msg As String = ("Source change is " & srcContact.ToString() & vbLf & "Destination change is ") & destContact.ToString() & vbLf & "Click Yes to rename the source change and apply it." & vbLf & "Click No to rename the destination item and apply the source change." & vbLf & "Click Cancel to delete the destination item and apply the source change."
        Dim ccDlg As New ConstraintConflictDlg(msg)
        ccDlg.ShowDialog()

        ' Set the resolution action based on the user's response.
        args.SetResolutionAction(ccDlg.Resolution)
    Else
        args.SetResolutionAction(ConstraintConflictResolutionAction.SaveConflict)
    End If
End Sub
void HandleItemConstraint(Object sender, ItemConstraintEventArgs args)
{
    if (ConstraintConflictReason.Collision == args.ConstraintConflictReason)
    {
        // Display the two items that are in conflict and solicit a resolution from the user.
        Contact srcContact = new Contact((string[])args.SourceChangeData);
        Contact destContact = new Contact((string[])args.DestinationChangeData);
        string msg = "Source change is " + srcContact.ToString() +
                   "\nDestination change is " + destContact.ToString() +
                   "\nClick Yes to rename the source change and apply it." +
                   "\nClick No to rename the destination item and apply the source change." +
                   "\nClick Cancel to delete the destination item and apply the source change.";
        ConstraintConflictDlg ccDlg = new ConstraintConflictDlg(msg);
        ccDlg.ShowDialog();

        // Set the resolution action based on the user's response.
        args.SetResolutionAction(ccDlg.Resolution);
    }
    else 
    {
        args.SetResolutionAction(ConstraintConflictResolutionAction.SaveConflict);
    }
}

See Also

Reference

Microsoft.Synchronization Namespace