Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update Microsoft365Apps to use the filelist API and dynamically determine channels. Removes hard coded channel list from the manifest
  • Loading branch information
aaronparker committed Apr 7, 2024
1 parent 3bd95fb commit 1f6d3f1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 51 deletions.
44 changes: 29 additions & 15 deletions Evergreen/Apps/Get-Microsoft365Apps.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Function Get-Microsoft365Apps {
function Get-Microsoft365Apps {
<#
.SYNOPSIS
Returns the latest Microsoft 365 Apps version number for each channel and download.
Expand All @@ -8,34 +8,48 @@ Function Get-Microsoft365Apps {
Twitter: @stealthpuppy
#>
[OutputType([System.Management.Automation.PSObject])]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification="Product name is a plural")]
[CmdletBinding(SupportsShouldProcess = $False)]
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseSingularNouns", "", Justification = "Product name is a plural")]
[CmdletBinding(SupportsShouldProcess = $false)]
param (
[Parameter(Mandatory = $False, Position = 0)]
[Parameter(Mandatory = $false, Position = 0)]
[ValidateNotNull()]
[System.Management.Automation.PSObject]
$res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1])
)

# Get the channels for the Microsoft 365 Apps
$params = @{
Uri = $res.Get.Update.Channels
ContentType = $res.Get.Update.ContentType
}
$Channels = Invoke-EvergreenRestMethod @params

# Get the latest version details for the Microsoft 365 Apps
$params = @{
Uri = $res.Get.Update.Uri
ContentType = $res.Get.Update.ContentType
}
$Updates = Invoke-EvergreenRestMethod @params

ForEach ($Update in $Updates) {
# Walk through the channels to match versions and return details
foreach ($Channel in $Channels) {
$Item = $Updates | Where-Object { $_.channelId -eq $Channel.name }
if ($Item) {

# Find the release date for this version
$Date = ($Update.officeVersions | Where-Object { $_.legacyVersion -eq $Update.latestVersion }).availabilityDate
# Find the release date for this version
$OfficeVersion = $Item.officeVersions | Where-Object { $_.legacyVersion -eq $Item.latestVersion }

# Build and array of the latest release and download URLs
$PSObject = [PSCustomObject] @{
Version = $Update.latestVersion
Channel = $Update.channelId
Name = $res.Get.Update.ChannelNames.$($Update.channelId)
Date = [System.DateTime]$Date
URI = $res.Get.Download.Uri
# Build and array of the latest release and download URLs
$PSObject = [PSCustomObject] @{
Version = $Item.latestVersion
ReleaseVersion = $OfficeVersion.releaseVersion
Channel = $Channel.name
Name = $Channel.displayName
AvailableDate = ConvertTo-DateTime -DateTime $OfficeVersion.availabilityDate -Pattern $res.Get.Update.DateTime
EOSDate = ConvertTo-DateTime -DateTime $OfficeVersion.endOfSupportDate -Pattern $res.Get.Update.DateTime
URI = $res.Get.Download.Uri
}
Write-Output -InputObject $PSObject
}
Write-Output -InputObject $PSObject
}
}
38 changes: 2 additions & 36 deletions Evergreen/Manifests/Microsoft365Apps.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,43 +4,9 @@
"Get": {
"Update": {
"Uri": "https://clients.config.office.net/releases/v1.0/OfficeReleases",
"ChannelNames": {
"BetaChannel": "Beta",
"CurrentPreview": "Current Channel (Preview)",
"Current": "Current Channel",
"MonthlyEnterprise": "Monthly Enterprise",
"SemiAnnualPreview": "Semi-Annual Channel Preview",
"SemiAnnual": "Semi-Annual Channel",
"PerpetualVL2021": "Office LTSC 2021 Perpetual Enterprise",
"PerpetualVL2019": "Office 2019 Perpetual Enterprise"
},
"Channels": "https://config.office.com/api/filelist/channels",
"ContentType": "application/json; charset=utf-8",
"DateTime": "MM/dd/yyyy HH:mm"
},
"Update2": {
"Uri": "https://mrodevicemgr.officeapps.live.com/mrodevicemgrsvc/api/v2/C2RReleaseData?audienceFFN=",
"Channels": {
"BetaChannel": "5440fd1f-7ecb-4221-8110-145efaa6372f",
"CurrentPreview": "64256afe-f5d9-4f86-8936-8840a6a4f5be",
"Current": "492350f6-3a01-4f97-b9c0-c7c6ddf67d60",
"MonthlyEnterprise": "55336b82-a18d-4dd6-b5f6-9e5095c314a6",
"SemiAnnualPreview": "b8f9b850-328d-4355-9145-c59439a0c4cf",
"SemiAnnual": "7ffbc6bf-bc32-4f92-8982-f9dd17fd3114",
"PerpetualVL2021": "5030841d-c919-4594-8d2d-84ae4f96e58e",
"PerpetualVL2019": "f2e724c1-748f-4b47-8fb8-8e0d210e9208"
},
"ChannelNames": {
"BetaChannel": "Beta",
"CurrentPreview": "Current Channel (Preview)",
"Current": "Current Channel",
"MonthlyEnterprise": "Monthly Enterprise",
"SemiAnnualPreview": "Semi-Annual Channel Preview",
"SemiAnnual": "Semi-Annual Channel",
"PerpetualVL2021": "Office LTSC 2021 Perpetual Enterprise",
"PerpetualVL2019": "Office 2019 Perpetual Enterprise"
},
"ContentType": "application/json; charset=utf-8",
"DateTime": "MM/dd/yyyy HH:mm"
"DateTime": "dd/MM/yyyy HH:mm:ss a"
},
"Download": {
"Uri": "https://officecdn.microsoft.com/pr/wsus/setup.exe"
Expand Down

0 comments on commit 1f6d3f1

Please sign in to comment.