Skip to content

Get-VisioPage: -ID is a real page ID, new -Index takes positions (#232) - #234

Merged
saveenr merged 1 commit into
masterfrom
fix-232-get-visiopage-id
Oct 1, 2026
Merged

saveenr merged 1 commit into
masterfrom
fix-232-get-visiopage-id

Conversation

@saveenr

@saveenr saveenr commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Summary

Fixes #232, in the direction agreed there: Get-VisioPage -ID becomes a real page ID lookup, and a new -Index parameter takes positions, so the two meanings are explicit.

  • -ID now uses Pages.ItemFromID, the way Get-VisioShape -ID does for shapes. The docs, the cmdlet's own comment and the PageID column of Get-VisioPageCells already meant a real ID. Before, a real Page.ID gave the wrong page or threw: -ID 0 threw although the first page of a new document has ID 0.
  • -Index <int[]> (new, its own pagebyindex set) takes 1-based positions, matching Visio's page numbering. These are exactly the numbers the old -ID accepted, so a script that used -ID as a position only needs to change the parameter name. (The other cmdlets' -Index parameters are zero-based, but they index rows in a shape's data, not pages.)
  • -ID, -Index, -Name and -ActivePage cannot be combined.

Behavior change

Anyone relying on -ID as a position (including the old docs example Get-VisioPage -ID 1,3) gets different pages. The module changelog says so plainly and tells them to switch to -Index. A minor version bump for the module is appropriate.

Testing

  • 9 new tests in PageCmdletBindingTests; 6 of them failed against the old code. They cover real-ID lookup (including ID 0 and several IDs, and IDs that differ from positions), -Index positions, out-of-range values failing in the lookup rather than in binding, and the parameter-set clashes.
  • Debug build, local Visio: VTest.PowerShell 82/82, VTest.Models 104/104, VTest.Scripting 43/43.

Also

  • VisioPowerShell/CHANGELOG.md [Unreleased]: Added and Changed entries.
  • docs/TESTING.md, CLAUDE.md and the Models docs backlog entry (the Visio PowerShell docs note is release-gated) are updated.
  • The companion docs change is in saveenr/VisioPowerShellDocs (base branch visiops_v4_docs).

Closes #232

🤖 Generated with Claude Code

Get-VisioPage -ID treated its numbers as 1-based positions (Pages[id]) while
the docs, the cmdlet's own comment and Get-VisioShape -ID all mean a real ID,
so a real Page.ID gave the wrong page or threw (-ID 0 threw although the
first page of a new document has ID 0). -ID now uses Pages.ItemFromID. A new
-Index parameter, in its own pagebyindex set, takes the 1-based positions the
old behavior accepted, so a script that used -ID as a position only needs to
change the parameter name.

9 new tests (6 failed before the change). Behavior change, noted in the
module changelog. Remaining test counts, CLAUDE.md and the docs backlog entry
are updated.

Closes #232

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@saveenr
saveenr enabled auto-merge October 1, 2026 13:19
@saveenr
saveenr merged commit c6d6844 into master Oct 1, 2026
2 checks passed
@TheSevenPens
TheSevenPens deleted the fix-232-get-visiopage-id branch October 1, 2026 16:26
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.

Get-VisioPage -ID uses the page index, not the page ID

2 participants