From 06ab2c20236ceb4131576e70ffa9e0fbe9f23974 Mon Sep 17 00:00:00 2001 From: Mikael Karlsson <43226266+Micke-K@users.noreply.github.com> Date: Sat, 1 Mar 2025 12:08:16 +1100 Subject: [PATCH] Paging issues Device settings does not return next page so get top 500 Found a rare issue where Settings Catalog could return next page after all items were returned. This caused the app to crash when scrolling the list. --- Extensions/EndpointManager.psm1 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Extensions/EndpointManager.psm1 b/Extensions/EndpointManager.psm1 index 39e6505..0657e1a 100644 --- a/Extensions/EndpointManager.psm1 +++ b/Extensions/EndpointManager.psm1 @@ -856,6 +856,7 @@ function Invoke-InitializeModule Id = "DeviceCategories" ViewID = "IntuneGraphAPI" API = "/deviceManagement/deviceCategories" + QUERYLIST = "`$top=500" Permissons = @("DeviceManagementConfiguration.ReadWrite.All") GroupId = "DeviceConfiguration" }) @@ -1038,7 +1039,7 @@ function Set-EMViewPanel $global:btnLoadAllPages.add_click({ Write-Status "Loading $($global:curObjectType.Title) objects" [array]$graphObjects = Get-GraphObjects -property $global:curObjectType.ViewProperties -objectType $global:curObjectType -AllPages - $graphObjects | ForEach-Object { $global:dgObjects.ItemsSource.AddNewItem($_) | Out-Null } + $graphObjects | Where-Object { $_ -ne $null } | ForEach-Object { $global:dgObjects.ItemsSource.AddNewItem($_) | Out-Null } $global:dgObjects.ItemsSource.CommitNew() Set-GraphPagesButtonStatus Invoke-FilterBoxChanged $global:txtFilter -ForceUpdate @@ -1048,7 +1049,7 @@ function Set-EMViewPanel $global:btnLoadNextPage.add_click({ Write-Status "Loading $($global:curObjectType.Title) objects" [array]$graphObjects = Get-GraphObjects -property $global:curObjectType.ViewProperties -objectType $global:curObjectType -SinglePage - $graphObjects | ForEach-Object { $global:dgObjects.ItemsSource.AddNewItem($_) | Out-Null } + $graphObjects | Where-Object { $_ -ne $null } | ForEach-Object { $global:dgObjects.ItemsSource.AddNewItem($_) | Out-Null } $global:dgObjects.ItemsSource.CommitNew() Set-GraphPagesButtonStatus Invoke-FilterBoxChanged $global:txtFilter