fix: URL encode folder path in List-XlsFiles function
This commit is contained in:
parent
4a3c1bb26e
commit
5194dc0198
@ -72,8 +72,12 @@ function List-XlsFiles {
|
|||||||
# Get the folder ID first
|
# Get the folder ID first
|
||||||
# Construct the correct URI for the folder
|
# Construct the correct URI for the folder
|
||||||
# Remove the /sites/tax/Shared Documents part from the folder path
|
# Remove the /sites/tax/Shared Documents part from the folder path
|
||||||
$relativePath = $folderPath.Replace("/sites/tax/Shared Documents/", "")
|
$relativePath = $folderPath.Replace("/sites/tax/Shared Documents/", "").TrimStart("/")
|
||||||
$folderUri = "https://graph.microsoft.com/v1.0/drives/$($drive.Id)/root:$($relativePath)"
|
|
||||||
|
# URL encode the relative path
|
||||||
|
$encodedPath = [System.Web.HttpUtility]::UrlEncode($relativePath)
|
||||||
|
|
||||||
|
$folderUri = "https://graph.microsoft.com/v1.0/drives/$($drive.Id)/root:/$encodedPath"
|
||||||
$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
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user