diff --git a/MainForm.ps1 b/MainForm.ps1 index 760cb70..5a23649 100644 --- a/MainForm.ps1 +++ b/MainForm.ps1 @@ -74,9 +74,7 @@ $btnSaveConfig.Text = "Save Config" $btnSaveConfig.Add_Click({ Save-Config -SiteUrl $txtSiteUrl.Text ` -ProductionLibrary $txtProdLib.Text ` - -TempLibrary $txtTempLib.Text ` - -ClientId $config.ClientId ` - -ClientSecret $config.ClientSecret + -TempLibrary $txtTempLib.Text }) $form.Controls.AddRange(@( diff --git a/SharePointFunctions.ps1 b/SharePointFunctions.ps1 index 80e79da..7772723 100644 --- a/SharePointFunctions.ps1 +++ b/SharePointFunctions.ps1 @@ -19,17 +19,13 @@ function Save-Config { param( [string]$SiteUrl, [string]$ProductionLibrary, - [string]$TempLibrary, - [string]$ClientId, - [string]$ClientSecret + [string]$TempLibrary ) $config = @{ SiteUrl = $SiteUrl ProductionLibrary = $ProductionLibrary TempLibrary = $TempLibrary - ClientId = $ClientId - ClientSecret = $ClientSecret } $config | ConvertTo-Json | Set-Content $configPath @@ -38,17 +34,16 @@ function Save-Config { function Connect-SharePoint { try { $siteUrl = $script:txtSiteUrl.Text - $clientId = $config.ClientId - $clientSecret = $config.ClientSecret if (-not $siteUrl) { throw "Please enter a Site URL" } - Connect-PnPOnline -Url $siteUrl -ClientId $clientId -ClientSecret $clientSecret ` + # Remove client secret auth and use interactive auth instead + Connect-PnPOnline -Url $siteUrl -Interactive ` -WarningAction SilentlyContinue ` - -Tenant "sutterhill" ` # Match your tenant name - -Scopes @("AllSites.FullControl") # Required for folder browsing + -Tenant "sutterhill" ` + -Scopes @("AllSites.FullControl") return $true } diff --git a/config.json b/config.json index a8deb60..88fcaca 100644 --- a/config.json +++ b/config.json @@ -1,8 +1,5 @@ { "TempLibrary": "Documents/Temp", - "ClientId": "dcb744a3-96ee-4521-bb35-9909146d3a13", "SiteUrl": "https://sutterhill.sharepoint.com/sites/tax", - "ProductionLibrary": "Documents", - "ClientSecret": "9NR8Q~GHuB2gtdMXK0N6WbwtOFokXoXa~924Ebso", - "TenantId": "sutterhill" + "ProductionLibrary": "Documents" }