Closed brianbunke closed 7 years ago
The problem is this line: https://github.com/AtlassianPS/ConfluencePS/blob/develop/ConfluencePS/Public/Get-Page.ps1#L19
by allowing the parameter to by piped by property name, which is ID, piping a Space object (which also includes the id property), it thinks the Space is the PageID. We can:
-PageObject
which will take the pipe from Page objectsSorry, but would you please clarify your two suggestions?
ConfluencePS.Space
objectConfluencePS.Page
as input, thus not using $PageID
(with alias Id
) and allowing -Space
to get ConfluencePS.Space
object from the pipeBy changing this:
# Filter results by space object(s), typically from the pipeline
[Parameter(
Mandatory = $true,
ValueFromPipeline = $true,
ParameterSetName = "bySpaceObject"
)]
[Parameter(
ValueFromPipeline = $true,
ParameterSetName = "byTitle"
)]
[Parameter(
ValueFromPipeline = $true,
ParameterSetName = "byLabel"
)]
[ConfluencePS.Space]$Space,
To this:
# Filter results by space object(s), typically from the pipeline
[Parameter(
Mandatory = $true,
ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true,
ParameterSetName = "bySpaceObject"
)]
[Parameter(
ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true,
ParameterSetName = "byTitle"
)]
[Parameter(
ValueFromPipeline = $true,
ValueFromPipelineByPropertyName = $true,
ParameterSetName = "byLabel"
)]
[ConfluencePS.Space]$Space,
The problem is fixed for me. We can clean things up, but at first glance, this appears to solve the issue without breaking PageID piping.
That works indeed:
if more than one parameter can be bound from the pipeline by property name, the argument with the same type hint as the $_
in the pipe will be preferred
Expected Behavior
Piping
[ConfluencePS.Space]
objects intoGet-ConfluencePage
should bind to the-Space
parameter and filter page results accordingly.Current Behavior
I receive an error when attempting this.
Steps to Reproduce (for bugs)
Your Environment
ConfluencePS
develop
branch, a689311e61c12de9de5ba5d4de9db3b44be9c58f