diff --git a/SharePointFunctions.ps1 b/SharePointFunctions.ps1 index af98431..37cfb35 100644 --- a/SharePointFunctions.ps1 +++ b/SharePointFunctions.ps1 @@ -71,7 +71,9 @@ function List-XlsFiles { $script:txtStatus.Text += "Searching in folder: $folderPath`n" # Get the folder ID first # 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" try { $folderItem = Invoke-MgGraphRequest -Method GET -Uri $folderUri -ErrorAction Stop