fix: Handle Shared Documents URL format and update config
This commit is contained in:
parent
808b8e57f4
commit
aaabb11624
@ -111,7 +111,7 @@ function Move-Files {
|
|||||||
function Get-FolderBrowser {
|
function Get-FolderBrowser {
|
||||||
try {
|
try {
|
||||||
# Get site ID first
|
# Get site ID first
|
||||||
$siteUrl = $script:txtSiteUrl.Text
|
$siteUrl = $script:txtSiteUrl.Text.TrimEnd('/')
|
||||||
$site = Get-MgSite -Search $siteUrl | Where-Object { $_.WebUrl -eq $siteUrl }
|
$site = Get-MgSite -Search $siteUrl | Where-Object { $_.WebUrl -eq $siteUrl }
|
||||||
|
|
||||||
if (-not $site) {
|
if (-not $site) {
|
||||||
@ -120,10 +120,17 @@ function Get-FolderBrowser {
|
|||||||
|
|
||||||
# Get drive (document library)
|
# Get drive (document library)
|
||||||
$drives = Get-MgSiteDrive -SiteId $site.Id
|
$drives = Get-MgSiteDrive -SiteId $site.Id
|
||||||
$drive = $drives | Where-Object { $_.Name -eq $script:txtProdLib.Text }
|
# Handle "Shared Documents" special case
|
||||||
|
$libraryName = if ($script:txtProdLib.Text -eq "Shared Documents") {
|
||||||
|
"Documents"
|
||||||
|
} else {
|
||||||
|
$script:txtProdLib.Text
|
||||||
|
}
|
||||||
|
$drive = $drives | Where-Object { $_.Name -eq $libraryName }
|
||||||
|
|
||||||
if (-not $drive) {
|
if (-not $drive) {
|
||||||
throw "Library not found"
|
$script:txtStatus.Text += "Available libraries: $($drives.Name -join ', ')`n"
|
||||||
|
throw "Library not found: $libraryName"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Get folders
|
# Get folders
|
||||||
@ -134,7 +141,7 @@ function Get-FolderBrowser {
|
|||||||
$folderObjects = $folders | ForEach-Object {
|
$folderObjects = $folders | ForEach-Object {
|
||||||
[PSCustomObject]@{
|
[PSCustomObject]@{
|
||||||
Name = $_.Name
|
Name = $_.Name
|
||||||
ServerRelativeUrl = "/sites/$($site.Name)/$($drive.Name)/$($_.Name)"
|
ServerRelativeUrl = "/sites/tax/Shared Documents/$($_.Name)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"SiteUrl": "https://sutterhill.sharepoint.com/sites/tax/",
|
"SiteUrl": "https://sutterhill.sharepoint.com/sites/tax/",
|
||||||
"ProductionLibrary": "",
|
"ProductionLibrary": "Shared Documents",
|
||||||
"TempLibrary": ""
|
"TempLibrary": "Temp"
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user