Skip to content

Updates 'spo page set' with isRetired option#7096

Merged
MartinM85 merged 2 commits intopnp:mainfrom
milanholemans:enhances-pageset
Jan 8, 2026
Merged

Updates 'spo page set' with isRetired option#7096
MartinM85 merged 2 commits intopnp:mainfrom
milanholemans:enhances-pageset

Conversation

@milanholemans
Copy link
Copy Markdown
Contributor

Closes #7095

Remarks

  • Fixed a bug where you were unable to update the page when only using --content and --publish options.
  • Tried to make the command a bit more performant by reducing the number of requests made.

Copilot AI review requested due to automatic review settings January 6, 2026 15:04
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new --isRetired option to the spo page set command to mark SharePoint Online pages as retired (showing a warning banner). Additionally, it includes a bug fix for updating pages with only --content and --publish options, and performance improvements by reducing redundant API calls to getFileAsListItemByUrl.

Key changes:

  • Added isRetired boolean option to mark/unmark pages as retired using the _SPIsRetired SharePoint field
  • Fixed bug where needsToSavePage logic didn't include content option, preventing proper updates
  • Improved performance by using pageId from checkout instead of making additional getFileAsListItemByUrl calls
  • Changed systemUpdateListItem signature to accept number instead of string for itemId parameter

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/utils/spo.ts Changed systemUpdateListItem parameter type from string to number for itemId, removing unnecessary type conversion
src/utils/spo.spec.ts Updated test calls to pass numbers instead of strings to systemUpdateListItem
src/m365/spo/commands/page/page-set.ts Added isRetired option, fixed needsToSavePage to include content, and optimized by removing redundant getFileAsListItemByUrl calls
src/m365/spo/commands/page/page-set.spec.ts Added test for isRetired functionality and updated existing test expectations
src/m365/spo/commands/listitem/listitem-set.ts Updated to convert string ID to number when calling systemUpdateListItem
docs/docs/cmd/spo/page/page-set.mdx Added documentation for isRetired option, permissions section, and minor formatting improvements

Comment thread src/m365/spo/commands/page/page-set.ts
Comment thread docs/docs/cmd/spo/page/page-set.mdx Outdated
Comment thread src/m365/spo/commands/page/page-set.spec.ts
Comment thread src/m365/spo/commands/page/page-set.spec.ts
@MartinM85 MartinM85 assigned MartinM85 and unassigned MartinM85 Jan 8, 2026
Copy link
Copy Markdown
Contributor

@MartinM85 MartinM85 left a comment

Choose a reason for hiding this comment

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

Approved

@MartinM85 MartinM85 merged commit bc8ea65 into pnp:main Jan 8, 2026
10 checks passed
@milanholemans milanholemans deleted the enhances-pageset branch January 8, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enchance spo page set with isRetired option

3 participants