feat: Add explicit Connect button and streamline SharePoint connection
This commit is contained in:
parent
61be5f9256
commit
5b8bf83019
14
MainForm.ps1
14
MainForm.ps1
@ -77,13 +77,25 @@ $btnSaveConfig.Add_Click({
|
|||||||
-TempLibrary $txtTempLib.Text
|
-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(@(
|
$form.Controls.AddRange(@(
|
||||||
$txtSiteUrl,
|
$txtSiteUrl,
|
||||||
$txtProdLib,
|
$txtProdLib,
|
||||||
$txtTempLib,
|
$txtTempLib,
|
||||||
$txtFolder,
|
$txtFolder,
|
||||||
$btnBrowse,
|
$btnBrowse,
|
||||||
$btnSaveConfig
|
$btnSaveConfig,
|
||||||
|
$btnConnect
|
||||||
))
|
))
|
||||||
|
|
||||||
# Load configuration
|
# Load configuration
|
||||||
|
|||||||
@ -130,10 +130,6 @@ function Move-Files {
|
|||||||
}
|
}
|
||||||
function Get-FolderBrowser {
|
function Get-FolderBrowser {
|
||||||
try {
|
try {
|
||||||
if (-not (Connect-SharePoint)) {
|
|
||||||
return $null
|
|
||||||
}
|
|
||||||
|
|
||||||
# Verify library exists and is accessible
|
# Verify library exists and is accessible
|
||||||
$library = Get-PnPList -Identity $script:txtProdLib.Text -Includes RootFolder,HasUniqueRoleAssignments
|
$library = Get-PnPList -Identity $script:txtProdLib.Text -Includes RootFolder,HasUniqueRoleAssignments
|
||||||
if ($library.HasUniqueRoleAssignments) {
|
if ($library.HasUniqueRoleAssignments) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user