Add functionnality to Move button

This commit is contained in:
Sébastien QUEROL 2024-03-12 23:12:30 +01:00
parent f120caa0e2
commit f401ceb825
1 changed files with 14 additions and 6 deletions

View File

@ -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=(?<content>.*)}"
$pnpConnection -match "Url : (?<content>.*)/"
$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