Add SharePoint Rules cmdlets as replacement for retiring SharePoint Alerts #5123
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
SharePoint Rules Implementation - COMPLETE ✅
This PR implements cmdlets for SharePoint Rules, which is the replacement for SharePoint Alerts that are being retired in 2025.
Implementation Checklist
Create Model classes for SharePoint Rules
Create Core Cmdlets
Add Documentation
Add Tests
Build and Validate
Summary of Changes
New Cmdlets Added:
Get-PnPListRule - Retrieves SharePoint list or library rules
Add-PnPListRule - Creates a new rule
Set-PnPListRule - Updates an existing rule
Remove-PnPListRule - Deletes a rule
Model Classes:
Rule
- Main rule entity with RuleId, Title, Description, IsEnabled, TriggerCondition, ActionParameters, timestampsRuleTrigger
- Event type, condition, field valuesRuleAction
- Action type, email recipients, subject, body, additional parametersRulePipeBind
- Flexible input accepting Rule ID (Guid), Title (string), or Rule objectSharePoint REST API Integration:
GetAllRules
- POST toweb/lists(guid'{listId}')/GetAllRules
CreateRuleEx
- POST toweb/lists(guid'{listId}')/CreateRuleEx
UpdateRule
- POST toweb/lists(guid'{listId}')/UpdateRule
DeleteRule
- POST toweb/lists(guid'{listId}')/DeleteRule
Code Quality
✅ Build successful (0 warnings, 0 errors)
✅ Follows PnP PowerShell coding conventions (tabs, naming, patterns)
✅ Proper error handling with meaningful messages
✅ Pipeline support via ListPipeBind and RulePipeBind
✅ Comprehensive documentation with practical examples
✅ Test scaffolding following existing patterns
✅ Code review passed with no issues
✅ Changelog entry added referencing PR #5123
Migration Path for Users
Users can now migrate from the retiring SharePoint Alerts to SharePoint Rules:
Get/Add/Remove-PnPAlert
→ Rule functionality:Get/Add/Set/Remove-PnPListRule
Files Changed (17 files)
Source Code (8 files):
Documentation (4 files):
Tests (4 files):
Changelog (1 file):
Related Links
Original prompt
Fixes #5039
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.