ObjectChangeConflict.Resolve method (RefreshMode)

Resolves the discrepancies by assigning each field and property, for which there is a discrepancy, a value that is persisted to the database on the next call of SubmitChanges.

Namespace:  Microsoft.SharePoint.Linq
Assembly:  Microsoft.SharePoint.Linq (in Microsoft.SharePoint.Linq.dll)

Syntax

'Declaration
Public Sub Resolve ( _
    refreshMode As RefreshMode _
)
'Usage
Dim instance As ObjectChangeConflict
Dim refreshMode As RefreshMode

instance.Resolve(refreshMode)
public void Resolve(
    RefreshMode refreshMode
)

Parameters

Remarks

This overload of the Resolve(RefreshMode) method behaves exactly as Resolve(RefreshMode, Boolean) with its autoResolveDeletes parameter set to true.

Examples

The following example shows how Resolve(RefreshMode) is used in a catch block to respond to a ChangeConflictException:

foreach (TeamMember teamMember in teamSite.TeamMembers)
{
    teamMember.TopTask = “Fiscal Planning”;
}

try 
{
    teamSite.SubmitChanges(ConflictMode.ContinueOnConflict);
}
catch (ChangeConflictException e) 
{
    foreach (ObjectChangeConflict changedListItem in teamSite.ChangeConflicts)
    {
        // If another user has changed properties of a non-manager,
        // leave that other user’s changes, except for the TopTask field.
        if (((TeamMember)changedListItem.Object).IsManager = false)
        {        
             foreach (MemberChangeConflict changedField in changedListItem.MemberConflicts)
            {
                if (changedField.Member.Name == “TopTask”)
                {
                    changedField.Resolve(RefreshMode.KeepCurrentValues);
                }
                else
                {
                    changedField.Resolve(RefreshMode.OverwriteCurrentValues);
                }
            }
        }
        // But if another user has changed properties of a manager, let this
        // process’s changes override the other user’s changes.
        else
        {
            changedListItem.Resolve(RefreshMode.KeepCurrentValues);
        }    
    }

    teamSite.SubmitChanges();
} // end catch

See also

Reference

ObjectChangeConflict class

ObjectChangeConflict members

Resolve overload

Microsoft.SharePoint.Linq namespace