Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set-ConfluenceAttachment on Powershell 7.1.5 #197

Open
MustQ opened this issue Nov 1, 2021 · 0 comments
Open

Set-ConfluenceAttachment on Powershell 7.1.5 #197

MustQ opened this issue Nov 1, 2021 · 0 comments

Comments

@MustQ
Copy link

MustQ commented Nov 1, 2021

I'm working on automating the documentation of our VCS (Perforce) architecture. I built powershell functions around a templated hierarchy of pages on a confluence space to find the correct page and update existing attachments with the latest data. This code works on WindowsPowershell but does not work on Powershell 7.1+:

$ConfigurableDoc = $P4DocProjectCommitPage | Get-P4DocServerDocPage -ServerID $CurrentReplica -PageTitle Configurables
$DocToUpdate = $ConfigurableDoc | Get-ConfluenceAttachment -FileNameFilter 'MTL-P4E01_Configurables.xlsx'
Get-ConfluenceAttachment -name
$DocToUpdate | Set-ConfluenceAttachment -FilePath .\MTL-P4E01_Configurables.xlsx -Verbose

On WindowsPowershell, the above code works as expected and updates the attachment. On Powershell 7.1, I get this result:

> PS E:\PerforceConfluence\MTL\My-CommitSvr\My-EdgeSVR\PerforceConfiguration\Configurables> $DocToUpdate | Set-ConfluenceAttachment -FilePath .\My-EdgeSVR_Configurables.xlsx -Verbose
VERBOSE: [Set-ConfluenceAttachment] Function started
VERBOSE: Performing the operation "Updating attachment 'My-EdgeSVR_Configurables.xlsx'." on target "78708982".
VERBOSE: [Invoke-Method] Function started
VERBOSE: [Invoke-Method] Invoking method Post to URI https://confluence.contoso.com/rest/api/content/78708982/child/attachment/78709360/data
VERBOSE: [Invoke-Method] Invoke-WebRequest with:
Verbose         : False
InFile          : .\My-EdgeSVR_Configurables.xlsx
ErrorAction     : Stop
ContentType     : application/json; charset=utf-8
Uri             : https://confluence.contoso.com/rest/api/content/78708982/child/attachment/78709360/data
Credential      : System.Management.Automation.PSCredential
Method          : Post
Headers         : {Accept-Charset, Accept}
UseBasicParsing : True

VERBOSE: [Invoke-Method] Failed to get an answer from the server
VERBOSE: [Invoke-Method] No Web result object was returned from. This is unusual!
VERBOSE: [Invoke-Method] Function ended
VERBOSE: [Set-ConfluenceAttachment] Function ended

I'm using the latest release from the powershell Gallery that I manually edited to use ToInt64 rather than ToInt32.

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

No branches or pull requests

1 participant