Skip to content

Fix #5467: related to default column value / event receiver issue - #5468

Closed
gautamdsheth wants to merge 2 commits into
devfrom
fix/default-col-issue
Closed

gautamdsheth wants to merge 2 commits into
devfrom
fix/default-col-issue

Conversation

@gautamdsheth

Copy link
Copy Markdown
Collaborator

Type

  • Bug Fix
  • New Feature
  • Sample

Related Issues?

Fixes #5467

What is in this Pull Request ?

Log warning for event receiver issue when setting default column value

Copilot AI balanced review requested due to automatic review settings September 10, 2026 07:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

The accompanying Framework change downgrades unrelated registration failures to warnings by catching every ServerException.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Adds a warning when SharePoint cannot register the event receiver required to apply stored default column values.

Changes:

  • Checks for the required event receiver after storing defaults.
  • Warns when defaults will not be applied.
  • Documents the behavior change in the changelog.
File summaries
File Description
src/Commands/Lists/SetDefaultColumnValues.cs Adds event-receiver verification and warning.
CHANGELOG.md Records the changed failure behavior.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +81 to +83
if (list.GetEventReceiverByName("LocationBasedMetadataDefaultsReceiver ItemAdded") == null)
{
LogWarning("The default column values have been stored, but the 'LocationBasedMetadataDefaultsReceiver ItemAdded' event receiver could not be registered on the list, so SharePoint will not apply them to newly added items.");
@mdissel

mdissel commented Sep 10, 2026

Copy link
Copy Markdown

For now we found an alternative:
Post the registration of the event receiver to the SharePoint REST API via
$"{webUrl.TrimEnd('/')}/_api/web/lists(guid'{listId}')/EventReceivers"

…ceiver registration failure and provide a warning for stored default column values
@mdissel

mdissel commented Sep 13, 2026

Copy link
Copy Markdown

In my opinion this is not a fix, it's a bypass.

If we don't want to use the rest api as an alternative (no idea how long that keeps working) my suggestion would to let it fail by default and implement another book parameter skipAddingEventReciever

@gautamdsheth
gautamdsheth deleted the fix/default-col-issue branch October 5, 2026 19:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants