AtlassianPS/ConfluencePS

Set-ConfluenceInfo does not persist when called in a function

mcx808 opened this issue · 2 comments

I created a draft powershell script that called the following in the begin{} block:
Set-ConfluenceInfo -BaseURi "$baseUri" -Credential $ConfluenceCredential
Then in the process{} block I would use Get-ConfluencePage and Set-ConfluencePage with the following parameters:
Get-ConfluencePage -SpaceKey $SpaceKey | Where-Object {$_.Title -eq $PageTitle}

Once I was happy with the script I created a function around it and added to a module but it would always ask me for the ApiUrl when Get-ConfluencePage was called.

I temporary workaround was to add the following when wrapping as a function

$PSDefaultParameterValues['Disabled'] = $true
$apiUri = $baseUri + '/rest/api'
Get-ConfluencePage -SpaceKey $SpaceKey -ApiUri $apiUri -Credential $ConfluenceCredential| Where-Object {$_.Title -eq $PageTitle}

Is there a known issue for why the behaviour is different and incompatible when called as a function instead of script?

I got the same behavior.

For me, version 2.5.0 is working fine. I guess I stick with version right now...

any word from the developers?

I got the same behavior.

For me, version 2.5.0 is working fine. I guess I stick with version right now...

any word from the developers?

Nope, not a peep since I opened the issue. Considering the last commit was 3 years ago I'm guessing the project is abandoned.