fix: correct folder retrieval by using DriveId and DriveItemId
This commit is contained in:
parent
d3e21955da
commit
8f9df8e97d
@ -138,9 +138,11 @@ function Get-FolderBrowser {
|
|||||||
throw "Library not found: $libraryName"
|
throw "Library not found: $libraryName"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get folders
|
# Get root folder first
|
||||||
$folders = Get-MgDriveRoot -DriveId $drive.Id | Get-MgDriveItemChild -DriveId $drive.Id
|
$root = Get-MgDriveRoot -DriveId $drive.Id
|
||||||
$folders = $folders | Where-Object { $_.Folder }
|
|
||||||
|
# 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
|
# Create custom objects for the grid view
|
||||||
$folderObjects = $folders | ForEach-Object {
|
$folderObjects = $folders | ForEach-Object {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user