fix: correct folder retrieval by using DriveId and DriveItemId

This commit is contained in:
Bobby Abellana (aider) 2025-02-19 15:49:28 -08:00
parent d3e21955da
commit 8f9df8e97d

View File

@ -138,9 +138,11 @@ function Get-FolderBrowser {
throw "Library not found: $libraryName"
}
# Get folders
$folders = Get-MgDriveRoot -DriveId $drive.Id | Get-MgDriveItemChild -DriveId $drive.Id
$folders = $folders | Where-Object { $_.Folder }
# Get root folder first
$root = Get-MgDriveRoot -DriveId $drive.Id
# Get folders using the root item's ID
$folders = Get-MgDriveItemChild -DriveId $drive.Id -DriveItemId $root.Id | Where-Object { $_.Folder }
# Create custom objects for the grid view
$folderObjects = $folders | ForEach-Object {