Compartilhar via


MemberChangeConflict.Member Property

Gets metadata information about the property of the list item object that represents the field for which there is a discrepancy.

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

Syntax

'Declaration
Public ReadOnly Property Member As MemberInfo
    Get
'Usage
Dim instance As MemberChangeConflict
Dim value As MemberInfo

value = instance.Member
public MemberInfo Member { get; }

Property Value

Type: System.Reflection.MemberInfo
A MemberInfo object that holds information about the property.

Remarks

Member is a kind of once-removed representation of the column (field) in the list item for which there is a discrepancy. You can use the MemberInfo properties to determine what list item field is involved in the discrepancy and, thus, what overload of Resolve() your code should call for the MemberChangeConflict and what parameters it should pass to Resolve().

But strictly speaking Member represents the property of a content type class. Specifically, it represents a property that itself represents the list column. For example, suppose the content type class is TeamMember and it represents the content type of a Team Member list. If the content type has a Top Task column, then the TeamMember class will have a property named TopTask. So, if the discrepancy is for the Top Task field, then Member. Name is “TopTask”, not “Top Task”.

Examples

The following example, shows Member being used to determine how to resolve a discrepancy.

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
For Each teamMember As TeamMember In teamSite.TeamMembers
    teamMember.TopTask = "Fiscal Planning"
Next teamMember

Try
    teamSite.SubmitChanges(ConflictMode.ContinueOnConflict)
Catch e As ChangeConflictException
    For Each changedListItem As ObjectChangeConflict 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 Not (CType(changedListItem.Object, TeamMember)).IsManager Then
             For Each changedField As MemberChangeConflict In changedListItem.MemberConflicts
                If changedField.Member.Name = "TopTask" Then
                    changedField.Resolve(RefreshMode.KeepCurrentValues)
                Else
                    changedField.Resolve(RefreshMode.OverwriteCurrentValues)
                End If
             Next changedField
        ' 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)
        End If
    Next changedListItem

    teamSite.SubmitChanges()
End Try ' end catch

See Also

Reference

MemberChangeConflict Class

MemberChangeConflict Members

Microsoft.SharePoint.Linq Namespace