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
|
||||
# Construct the correct URI for the folder
|
||||
# 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)"
|
||||
$relativePath = $folderPath.Replace("/sites/tax/Shared Documents/", "").TrimStart("/")
|
||||
|
||||
# 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"
|
||||
try {
|
||||
$folderItem = Invoke-MgGraphRequest -Method GET -Uri $folderUri -ErrorAction Stop
|
||||
|
||||
Loading…
Reference in New Issue
Block a user