Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

feat: Add GetDifferences method for ListItem field change detection#1202

Open
jeppesc11 wants to merge 1 commit into
pnp:devpnp/pnpframework:devfrom
jeppesc11:feature/listitem-getdifferencesjeppesc11/pnpframework:feature/listitem-getdifferencesCopy head branch name to clipboard
Open

feat: Add GetDifferences method for ListItem field change detection#1202
jeppesc11 wants to merge 1 commit into
pnp:devpnp/pnpframework:devfrom
jeppesc11:feature/listitem-getdifferencesjeppesc11/pnpframework:feature/listitem-getdifferencesCopy head branch name to clipboard

Conversation

@jeppesc11

Copy link
Copy Markdown

Summary

Adds field change detection capabilities to ListItem with a new GetDifferences extension method that compares current and new field values,

Features:

• Comprehensive field type support: User, Lookup, Multi-lookup, Taxonomy, Geolocation, URL, DateTime, numeric types, and arrays
• Flexible null/empty handling: treatEmptyStringAsNull parameter for configurable empty string behavior
• Missing field handling: Treats non-existent fields as null values

Usage

var newValues = new Dictionary<string, object>
{
    ["Title"] = "Updated Title",
    ["AssignedTo"] = new FieldUserValue { LookupId = 5 },
    ["Categories"] = new[] { "Category1", "Category2" }
};

var differences = listItem.GetDifferences(newValues, treatEmptyStringAsNull: true);

foreach (var change in differences)
{
    Console.WriteLine($"Field '{change.FieldInternalName}' changed from '{change.CurrentValue}' to '{change.NewValue}'");
}

Breaking Changes

None - this is a new addition that doesn't affect existing functionality.

- Implement GetDifferences extension method to compare current and new field values
- Return FieldChange objects containing field name, new value, and current value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.