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 {
|
||||
try {
|
||||
# Get site ID first
|
||||
$siteUrl = $script:txtSiteUrl.Text
|
||||
$siteUrl = $script:txtSiteUrl.Text.TrimEnd('/')
|
||||
$site = Get-MgSite -Search $siteUrl | Where-Object { $_.WebUrl -eq $siteUrl }
|
||||
|
||||
if (-not $site) {
|
||||
@ -120,10 +120,17 @@ function Get-FolderBrowser {
|
||||
|
||||
# Get drive (document library)
|
||||
$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) {
|
||||
throw "Library not found"
|
||||
$script:txtStatus.Text += "Available libraries: $($drives.Name -join ', ')`n"
|
||||
throw "Library not found: $libraryName"
|
||||
}
|
||||
|
||||
# Get folders
|
||||
@ -134,7 +141,7 @@ function Get-FolderBrowser {
|
||||
$folderObjects = $folders | ForEach-Object {
|
||||
[PSCustomObject]@{
|
||||
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/",
|
||||
"ProductionLibrary": "",
|
||||
"TempLibrary": ""
|
||||
"ProductionLibrary": "Shared Documents",
|
||||
"TempLibrary": "Temp"
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user