Unable to get URI for PSObject #600
-
Hi, I am pulling my hair out... I am trying to add a new app, but am getting the following error:
I have the following app file:
And the following json manifest:
The strange thing is that I can get the download URI in the Verbose text: But not in the $PSObject. What am I missing? Thanks in advance for all help. //Jasper |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Here's a fix - note that I've updated this to return the installer and the MSP file included in the XML: {
"Name": "Clarivate EndNote",
"Source": "https://www.endnote.com/",
"Get": {
"Update": {
"Releases": [
"20",
"21"
],
"Uri": {
"20": "https://download.endnote.com/updates/20.0/EN20WinUpdates.xml",
"21": "https://download.endnote.com/updates/21.0/EN21WinUpdates.xml"
}
},
"Download": {
"Uri": {
"20": "https://download.endnote.com/downloads/20/EN20Inst.exe",
"21": "https://download.endnote.com/downloads/21/EN21Inst.exe"
}
}
},
"Install": {
"Setup": "",
"Physical": {
"Arguments": "",
"PostInstall": []
},
"Virtual": {
"Arguments": "",
"PostInstall": []
}
}
} function Get-ClarivateEndNote {
<#
.SYNOPSIS
Get the current version and download URIs for the supported releases of Endnote.
.NOTES
Author: Jasper Metselaar
E-mail: [email protected]
#>
[OutputType([System.Management.Automation.PSObject])]
[CmdletBinding(SupportsShouldProcess = $false)]
param (
[Parameter(Mandatory = $false, Position = 0)]
[ValidateNotNull()]
[System.Management.Automation.PSObject]
$res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1])
)
foreach ($Release in $res.Get.Update.Releases) {
Write-Verbose -Message "$($MyInvocation.MyCommand): Release: $Release"
Write-Verbose -Message "$($MyInvocation.MyCommand): Endnote Update URL: $($res.Get.Update.Uri.$Release)"
Write-Verbose -Message "$($MyInvocation.MyCommand): Download URL: $($res.Get.Download.Uri.$Release)"
# Query the EndNote update API
$UpdateFeed = Invoke-EvergreenRestMethod -Uri $res.Get.Update.Uri.($Release)
if ($null -ne $UpdateFeed) {
# Sort the updates to find the latest
$Update = $UpdateFeed.updates.build | `
Sort-Object -Property @{ Expression = { [System.Version]$_.version }; Descending = $true } -ErrorAction "SilentlyContinue" | `
Select-Object -First 1
# Construct the output for the installer; Return the custom object to the pipeline
$PSObject = [PSCustomObject] @{
Version = $Update.version
Release = $Release
Type = Get-FileType -File $res.Get.Download.Uri.($Release)
URI = $res.Get.Download.Uri.($Release)
}
Write-Output -InputObject $PSObject
# Construct the output for the MSP patch; Return the custom object to the pipeline
$PSObject = [PSCustomObject] @{
Version = $Update.version
Release = $Release
Type = Get-FileType -File $Update.url
URI = $Update.url
}
Write-Output -InputObject $PSObject
}
}
} |
Beta Was this translation helpful? Give feedback.
-
Thank you for your help. I knew I was missing something rather small, but important. :) I have submitted a Pull request for the Endnote app now. //Jasper |
Beta Was this translation helpful? Give feedback.
Here's a fix - note that I've updated this to return the installer and the MSP file included in the XML: