fix: Correct folder path resolution in List-XlsFiles function

This commit is contained in:
Bobby Abellana (aider) 2025-02-21 09:24:12 -08:00
parent c955fed489
commit 4a3c1bb26e

View File

@ -71,7 +71,9 @@ function List-XlsFiles {
$script:txtStatus.Text += "Searching in folder: $folderPath`n" $script:txtStatus.Text += "Searching in folder: $folderPath`n"
# Get the folder ID first # Get the folder ID first
# Construct the correct URI for the folder # Construct the correct URI for the folder
$folderUri = "https://graph.microsoft.com/v1.0/drives/$($drive.Id)/root:$($folderPath)" # Remove the /sites/tax/Shared Documents part from the folder path
$relativePath = $folderPath.Replace("/sites/tax/Shared Documents/", "")
$folderUri = "https://graph.microsoft.com/v1.0/drives/$($drive.Id)/root:$($relativePath)"
$script:txtStatus.Text += "Folder URI: $folderUri`n" $script:txtStatus.Text += "Folder URI: $folderUri`n"
try { try {
$folderItem = Invoke-MgGraphRequest -Method GET -Uri $folderUri -ErrorAction Stop $folderItem = Invoke-MgGraphRequest -Method GET -Uri $folderUri -ErrorAction Stop