feat: Add explicit Connect button and streamline SharePoint connection

This commit is contained in:
Bobby Abellana (aider) 2025-02-19 15:10:59 -08:00
parent 61be5f9256
commit 5b8bf83019
2 changed files with 13 additions and 5 deletions

View File

@ -77,13 +77,25 @@ $btnSaveConfig.Add_Click({
-TempLibrary $txtTempLib.Text
})
# Add Connect button
$btnConnect = New-Object System.Windows.Forms.Button
$btnConnect.Location = New-Object System.Drawing.Point(320,40)
$btnConnect.Size = New-Object System.Drawing.Size(80,20)
$btnConnect.Text = "Connect"
$btnConnect.Add_Click({
if (Connect-SharePoint) {
$script:txtStatus.Text += "Successfully connected to SharePoint`n"
}
})
$form.Controls.AddRange(@(
$txtSiteUrl,
$txtProdLib,
$txtTempLib,
$txtFolder,
$btnBrowse,
$btnSaveConfig
$btnSaveConfig,
$btnConnect
))
# Load configuration

View File

@ -130,10 +130,6 @@ function Move-Files {
}
function Get-FolderBrowser {
try {
if (-not (Connect-SharePoint)) {
return $null
}
# Verify library exists and is accessible
$library = Get-PnPList -Identity $script:txtProdLib.Text -Includes RootFolder,HasUniqueRoleAssignments
if ($library.HasUniqueRoleAssignments) {