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.
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+:
On WindowsPowershell, the above code works as expected and updates the attachment. On Powershell 7.1, I get this result:
I'm using the latest release from the powershell Gallery that I manually edited to use ToInt64 rather than ToInt32.