From f401ceb825f7cd4c1cba076ec90b627a27453661 Mon Sep 17 00:00:00 2001 From: Kawawete Date: Tue, 12 Mar 2024 23:12:30 +0100 Subject: [PATCH] Add functionnality to Move button --- Sharepoint/gui/spmover/sputils.ps1 | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/Sharepoint/gui/spmover/sputils.ps1 b/Sharepoint/gui/spmover/sputils.ps1 index 45d4fd9..7fb6113 100644 --- a/Sharepoint/gui/spmover/sputils.ps1 +++ b/Sharepoint/gui/spmover/sputils.ps1 @@ -317,9 +317,9 @@ $label4.Size = New-Object System.Drawing.Size(66, 13) $label4.TabIndex = 3 $label4.TextAlign = [System.Drawing.ContentAlignment]::MiddleCenter ##On modifie le texte du label en fonction de l'état initial de la connection a PNPOnline -$pnpConnection = Get-PnPConnection +$pnpConnection = Get-PnPConnection | Out-string if(-not ([string]::IsNullOrEmpty($pnpConnection))){ - $pnpConnection -match "@{Url=(?.*)}" + $pnpConnection -match "Url : (?.*)/" $pnpConnectionUrl = $matches["content"] $label4.Text = "Connecté" $label4.ForeColor = [System.Drawing.Color]::Green @@ -366,7 +366,9 @@ $LresultsMove.Location = New-Object System.Drawing.Point(8, 173) $LresultsMove.Name = "LresultsMove" $LresultsMove.Size = New-Object System.Drawing.Size(776, 190) $LresultsMove.TabIndex = 7 -$LresultsMove.UseCompatibleStateImageBehavior = $false +$LresultsMove.AutoSize = $true +#$LresultsMove.MultiColumn = $false +#$LresultsMove.UseCompatibleStateImageBehavior = $false # # FMain # @@ -385,7 +387,7 @@ $BlistSites.Add_Click({ #On vide la variable pnpConnection pour ne pas avoir de faux positifs $pnpConnection=$Null #On stocke la derniere connection PnP - $pnpConnection = Get-PnPConnection + $pnpConnection = Get-PnPConnection | Out-string #A ameliorer, mais pour l'instant, ca devrait passer if(-not ([string]::IsNullOrEmpty($pnpConnection))){ $CBdestSite.Items.Clear() @@ -414,14 +416,20 @@ $BlistSites.Add_Click({ ##Bouger les dossiers $Bgo.Add_Click({ $sourceSite = $CBsourceSite.Text - $LresultsMove.Items.Add($sourceSite) + $destSite = $CBdestSite.Text + + $jobMovePending = Copy-PnPFile -SourceUrl $sourceSite -TargetUrl $destSite -Force -OverwriteIfAlreadyExists + $jobStatus = Receive-PnPCopyMoveJobStatus -Job $jobMovePending + Write-Host $jobStatus + + }) #Onglet Parametres ##Connexion Sharepoint $BconnectSP.Add_Click({ $pnpConnection=$null - $pnpConnection = Get-PnPConnection + $pnpConnection = Get-PnPConnection | Out-string $tenantURL = $URLTenant.Text $connResults = Connect-PnPOnline -Url $tenantURL -Interactive 2>&1 | Out-String