Compare commits

...

2 Commits

Author SHA1 Message Date
Kawawete 54ee71c7f2 Merge branch 'main' of https://git.azuze.fr/kawa/ps-scripts 2024-03-08 17:10:44 +01:00
Kawawete 3e6e4102ee Add new tabs (yay more work for me) 2024-03-08 17:07:29 +01:00
1 changed files with 263 additions and 75 deletions

View File

@ -1,14 +1,14 @@
################################################################################ ################################################################################
# #
# Name : SharePoint Mover # Name : C:\Users\SebastienQUEROL\source\repos\sharepointmover-gui\Form1.ps1
# Version : 0.1 # Version : 0.1
# Author : # Author :
# Date : 07/03/2024 # Date : 08/03/2024
# #
# Generated with ConvertForm module version 2.0.0 # Generated with ConvertForm module version 2.0.0
# PowerShell version 7.4.1 # PowerShell version 7.4.1
# #
# Invocation Line : Convert-Form -Path $Source -Destination $Destination -Encoding ascii -force # Invocation Line : Convert-Form -Path $Source -Destination $Destination -Encoding utf8 -force
# Source : C:\Users\SebastienQUEROL\source\repos\sharepointmover-gui\Form1.Designer.cs # Source : C:\Users\SebastienQUEROL\source\repos\sharepointmover-gui\Form1.Designer.cs
################################################################################ ################################################################################
@ -28,8 +28,6 @@ $FMain = New-Object System.Windows.Forms.Form
$components = New-Object System.ComponentModel.Container $components = New-Object System.ComponentModel.Container
$menuStrip1 = New-Object System.Windows.Forms.MenuStrip $menuStrip1 = New-Object System.Windows.Forms.MenuStrip
$Mconnexion = New-Object System.Windows.Forms.ToolStripMenuItem
$MConnexionSharepoint = New-Object System.Windows.Forms.ToolStripMenuItem
$Mquestion = New-Object System.Windows.Forms.ToolStripMenuItem $Mquestion = New-Object System.Windows.Forms.ToolStripMenuItem
$MQuestionApropos = New-Object System.Windows.Forms.ToolStripMenuItem $MQuestionApropos = New-Object System.Windows.Forms.ToolStripMenuItem
$MQuestionWiki = New-Object System.Windows.Forms.ToolStripMenuItem $MQuestionWiki = New-Object System.Windows.Forms.ToolStripMenuItem
@ -40,11 +38,28 @@ $progressBar1 = New-Object System.Windows.Forms.ProgressBar
$sourceInfo = New-Object System.Windows.Forms.ToolTip($components) $sourceInfo = New-Object System.Windows.Forms.ToolTip($components)
$label1 = New-Object System.Windows.Forms.Label $label1 = New-Object System.Windows.Forms.Label
$label2 = New-Object System.Windows.Forms.Label $label2 = New-Object System.Windows.Forms.Label
$tabs = New-Object System.Windows.Forms.TabControl
$tabPage1 = New-Object System.Windows.Forms.TabPage
$tabPage2 = New-Object System.Windows.Forms.TabPage
$BconnectSP = New-Object System.Windows.Forms.Button
$textBox1 = New-Object System.Windows.Forms.TextBox
$label3 = New-Object System.Windows.Forms.Label
$groupBox1 = New-Object System.Windows.Forms.GroupBox
$groupBox2 = New-Object System.Windows.Forms.GroupBox
$radioButton1 = New-Object System.Windows.Forms.RadioButton
$radioButton2 = New-Object System.Windows.Forms.RadioButton
$radioButton3 = New-Object System.Windows.Forms.RadioButton
$button1 = New-Object System.Windows.Forms.Button
$checkBox1 = New-Object System.Windows.Forms.CheckBox
$label4 = New-Object System.Windows.Forms.Label
$tabPage3 = New-Object System.Windows.Forms.TabPage
$tabPage4 = New-Object System.Windows.Forms.TabPage
$tabPage5 = New-Object System.Windows.Forms.TabPage
$LresultsMove = New-Object System.Windows.Forms.ListView
# #
# menuStrip1 # menuStrip1
# #
$menuStrip1.Items.AddRange(@( $menuStrip1.Items.AddRange(@(
$Mconnexion,
$Mquestion)) $Mquestion))
$menuStrip1.Location = New-Object System.Drawing.Point(0, 0) $menuStrip1.Location = New-Object System.Drawing.Point(0, 0)
$menuStrip1.Name = "menuStrip1" $menuStrip1.Name = "menuStrip1"
@ -52,21 +67,6 @@ $menuStrip1.Size = New-Object System.Drawing.Size(800, 24)
$menuStrip1.TabIndex = 0 $menuStrip1.TabIndex = 0
$menuStrip1.Text = "menuStrip1" $menuStrip1.Text = "menuStrip1"
# #
# Mconnexion
#
$Mconnexion.DropDownItems.AddRange(@(
$MConnexionSharepoint))
$Mconnexion.Name = "Mconnexion"
$Mconnexion.Size = New-Object System.Drawing.Size(77, 20)
$Mconnexion.Text = "Connexion"
#
# MConnexionSharepoint
#
$MConnexionSharepoint.CheckOnClick = $true
$MConnexionSharepoint.Name = "MConnexionSharepoint"
$MConnexionSharepoint.Size = New-Object System.Drawing.Size(131, 22)
$MConnexionSharepoint.Text = "Sharepoint"
#
# Mquestion # Mquestion
# #
$Mquestion.DropDownItems.AddRange(@( $Mquestion.DropDownItems.AddRange(@(
@ -79,19 +79,19 @@ $Mquestion.Text = "?"
# MQuestionApropos # MQuestionApropos
# #
$MQuestionApropos.Name = "MQuestionApropos" $MQuestionApropos.Name = "MQuestionApropos"
$MQuestionApropos.Size = New-Object System.Drawing.Size(131, 22) $MQuestionApropos.Size = New-Object System.Drawing.Size(180, 22)
$MQuestionApropos.Text = "A propos..." $MQuestionApropos.Text = "A propos..."
# #
# MQuestionWiki # MQuestionWiki
# #
$MQuestionWiki.Name = "MQuestionWiki" $MQuestionWiki.Name = "MQuestionWiki"
$MQuestionWiki.Size = New-Object System.Drawing.Size(131, 22) $MQuestionWiki.Size = New-Object System.Drawing.Size(180, 22)
$MQuestionWiki.Text = "Wiki" $MQuestionWiki.Text = "Wiki"
# #
# Bgo # Bgo
# #
$Bgo.ForeColor = [System.Drawing.Color]::White $Bgo.ForeColor = [System.Drawing.Color]::Black
$Bgo.Location = New-Object System.Drawing.Point(688, 155) $Bgo.Location = New-Object System.Drawing.Point(649, 83)
$Bgo.Name = "Bgo" $Bgo.Name = "Bgo"
$Bgo.Size = New-Object System.Drawing.Size(75, 23) $Bgo.Size = New-Object System.Drawing.Size(75, 23)
$Bgo.TabIndex = 1 $Bgo.TabIndex = 1
@ -100,25 +100,23 @@ $Bgo.UseVisualStyleBackColor = $true
# #
# CBsourceSite # CBsourceSite
# #
$CBsourceSite.ForeColor = [System.Drawing.Color]::White $comboBox1.FormattingEnabled = $true
$CBsourceSite.FormattingEnabled = $true $comboBox1.Location = New-Object System.Drawing.Point(23, 44)
$CBsourceSite.Location = New-Object System.Drawing.Point(27, 131) $comboBox1.Name = "comboBox1"
$CBsourceSite.Name = "CBsourceSite" $comboBox1.Size = New-Object System.Drawing.Size(587, 21)
$CBsourceSite.Size = New-Object System.Drawing.Size(587, 21) $comboBox1.TabIndex = 2
$CBsourceSite.TabIndex = 2
# #
# CBdestSite # CBdestSite
# #
$CBdestSite.ForeColor = [System.Drawing.Color]::White $comboBox2.FormattingEnabled = $true
$CBdestSite.FormattingEnabled = $true $comboBox2.Location = New-Object System.Drawing.Point(23, 113)
$CBdestSite.Location = New-Object System.Drawing.Point(27, 182) $comboBox2.Name = "comboBox2"
$CBdestSite.Name = "CBdestSite" $comboBox2.Size = New-Object System.Drawing.Size(587, 21)
$CBdestSite.Size = New-Object System.Drawing.Size(587, 21) $comboBox2.TabIndex = 3
$CBdestSite.TabIndex = 3
# #
# progressBar1 # progressBar1
# #
$progressBar1.Location = New-Object System.Drawing.Point(12, 345) $progressBar1.Location = New-Object System.Drawing.Point(8, 369)
$progressBar1.Name = "progressBar1" $progressBar1.Name = "progressBar1"
$progressBar1.Size = New-Object System.Drawing.Size(776, 23) $progressBar1.Size = New-Object System.Drawing.Size(776, 23)
$progressBar1.TabIndex = 4 $progressBar1.TabIndex = 4
@ -126,61 +124,251 @@ $progressBar1.TabIndex = 4
# label1 # label1
# #
$label1.AutoSize = $true $label1.AutoSize = $true
$label1.Location = New-Object System.Drawing.Point(27, 112) $label1.ForeColor = [System.Drawing.Color]::Black
$label1.Location = New-Object System.Drawing.Point(23, 19)
$label1.Name = "label1" $label1.Name = "label1"
$label1.Size = New-Object System.Drawing.Size(62, 13) $label1.Size = New-Object System.Drawing.Size(41, 13)
$label1.TabIndex = 5 $label1.TabIndex = 5
$label1.Text = "Site Source" $label1.Text = "Source"
# #
# label2 # label2
# #
$label2.AutoSize = $true $label2.AutoSize = $true
$label2.Location = New-Object System.Drawing.Point(27, 166) $label2.ForeColor = [System.Drawing.Color]::Black
$label2.Location = New-Object System.Drawing.Point(23, 88)
$label2.Name = "label2" $label2.Name = "label2"
$label2.Size = New-Object System.Drawing.Size(81, 13) $label2.Size = New-Object System.Drawing.Size(60, 13)
$label2.TabIndex = 6 $label2.TabIndex = 6
$label2.Text = "Site Destination" $label2.Text = "Destination"
#
# tabs
#
$tabs.Controls.Add($tabPage1)
$tabs.Controls.Add($tabPage3)
$tabs.Controls.Add($tabPage4)
$tabs.Controls.Add($tabPage5)
$tabs.Controls.Add($tabPage2)
$tabs.Location = New-Object System.Drawing.Point(0, 27)
$tabs.Name = "tabs"
$tabs.SelectedIndex = 0
$tabs.Size = New-Object System.Drawing.Size(800, 424)
$tabs.TabIndex = 7
#
# tabPage1
#
$tabPage1.Controls.Add($LresultsMove)
$tabPage1.Controls.Add($label1)
$tabPage1.Controls.Add($progressBar1)
$tabPage1.Controls.Add($label2)
$tabPage1.Controls.Add($Bgo)
$tabPage1.Controls.Add($comboBox1)
$tabPage1.Controls.Add($comboBox2)
$tabPage1.Location = New-Object System.Drawing.Point(4, 22)
$tabPage1.Name = "tabPage1"
$tabPage1.Padding = New-Object System.Windows.Forms.Padding(3)
$tabPage1.Size = New-Object System.Drawing.Size(792, 398)
$tabPage1.TabIndex = 0
$tabPage1.Text = "Move"
$tabPage1.UseVisualStyleBackColor = $true
#
# tabPage2
#
$tabPage2.Controls.Add($groupBox2)
$tabPage2.Controls.Add($groupBox1)
$tabPage2.Location = New-Object System.Drawing.Point(4, 22)
$tabPage2.Name = "tabPage2"
$tabPage2.Padding = New-Object System.Windows.Forms.Padding(3)
$tabPage2.Size = New-Object System.Drawing.Size(792, 398)
$tabPage2.TabIndex = 1
$tabPage2.Text = "Parametres"
$tabPage2.UseVisualStyleBackColor = $true
#
# BconnectSP
#
$BconnectSP.ForeColor = [System.Drawing.Color]::Black
$BconnectSP.Location = New-Object System.Drawing.Point(376, 53)
$BconnectSP.Name = "BconnectSP"
$BconnectSP.Size = New-Object System.Drawing.Size(75, 23)
$BconnectSP.TabIndex = 0
$BconnectSP.Text = "Connexion"
$BconnectSP.UseVisualStyleBackColor = $true
#
# textBox1
#
$textBox1.Location = New-Object System.Drawing.Point(22, 55)
$textBox1.Name = "textBox1"
$textBox1.Size = New-Object System.Drawing.Size(325, 20)
$textBox1.TabIndex = 1
#
# label3
#
$label3.AutoSize = $true
$label3.ForeColor = [System.Drawing.Color]::Black
$label3.Location = New-Object System.Drawing.Point(22, 32)
$label3.Name = "label3"
$label3.Size = New-Object System.Drawing.Size(132, 13)
$label3.TabIndex = 2
$label3.Text = "URL du tenant SharePoint"
#
# groupBox1
#
$groupBox1.Controls.Add($label4)
$groupBox1.Controls.Add($label3)
$groupBox1.Controls.Add($BconnectSP)
$groupBox1.Controls.Add($textBox1)
$groupBox1.Location = New-Object System.Drawing.Point(8, 6)
$groupBox1.Name = "groupBox1"
$groupBox1.Size = New-Object System.Drawing.Size(473, 100)
$groupBox1.TabIndex = 3
$groupBox1.TabStop = $false
$groupBox1.Text = "Connexion"
#
# groupBox2
#
$groupBox2.Controls.Add($checkBox1)
$groupBox2.Controls.Add($button1)
$groupBox2.Controls.Add($radioButton3)
$groupBox2.Controls.Add($radioButton2)
$groupBox2.Controls.Add($radioButton1)
$groupBox2.Location = New-Object System.Drawing.Point(9, 113)
$groupBox2.Name = "groupBox2"
$groupBox2.Size = New-Object System.Drawing.Size(472, 145)
$groupBox2.TabIndex = 4
$groupBox2.TabStop = $false
$groupBox2.Text = "Rapports"
#
# radioButton1
#
$radioButton1.AutoSize = $true
$radioButton1.ForeColor = [System.Drawing.Color]::Black
$radioButton1.Location = New-Object System.Drawing.Point(23, 66)
$radioButton1.Name = "radioButton1"
$radioButton1.Size = New-Object System.Drawing.Size(141, 17)
$radioButton1.TabIndex = 0
$radioButton1.TabStop = $true
$radioButton1.Text = "Intégralité des messages"
$radioButton1.UseVisualStyleBackColor = $true
#
# radioButton2
#
$radioButton2.AutoSize = $true
$radioButton2.ForeColor = [System.Drawing.Color]::Black
$radioButton2.Location = New-Object System.Drawing.Point(23, 92)
$radioButton2.Name = "radioButton2"
$radioButton2.Size = New-Object System.Drawing.Size(109, 17)
$radioButton2.TabIndex = 1
$radioButton2.TabStop = $true
$radioButton2.Text = "Erreurs seulement"
$radioButton2.UseVisualStyleBackColor = $true
#
# radioButton3
#
$radioButton3.AutoSize = $true
$radioButton3.ForeColor = [System.Drawing.Color]::Black
$radioButton3.Location = New-Object System.Drawing.Point(23, 116)
$radioButton3.Name = "radioButton3"
$radioButton3.Size = New-Object System.Drawing.Size(113, 17)
$radioButton3.TabIndex = 2
$radioButton3.TabStop = $true
$radioButton3.Text = "Réussis seulement"
$radioButton3.UseVisualStyleBackColor = $true
#
# button1
#
$button1.ForeColor = [System.Drawing.Color]::Black
$button1.Location = New-Object System.Drawing.Point(21, 29)
$button1.Name = "button1"
$button1.Size = New-Object System.Drawing.Size(174, 23)
$button1.TabIndex = 3
$button1.Text = "Choix de l\'emplacement..."
$button1.UseVisualStyleBackColor = $true
#
# checkBox1
#
$checkBox1.AutoSize = $true
$checkBox1.ForeColor = [System.Drawing.Color]::Black
$checkBox1.Location = New-Object System.Drawing.Point(189, 68)
$checkBox1.Name = "checkBox1"
$checkBox1.Size = New-Object System.Drawing.Size(153, 17)
$checkBox1.TabIndex = 4
$checkBox1.Text = "Inclure ligne de commande"
$checkBox1.UseVisualStyleBackColor = $true
#
# label4
#
$label4.AutoSize = $true
$label4.ForeColor = [System.Drawing.Color]::MediumVioletRed
$label4.Location = New-Object System.Drawing.Point(380, 32)
$label4.Name = "label4"
$label4.Size = New-Object System.Drawing.Size(66, 13)
$label4.TabIndex = 3
$label4.Text = "Déconnecté"
$label4.TextAlign = [System.Drawing.ContentAlignment]::MiddleCenter
#
# tabPage3
#
$tabPage3.Location = New-Object System.Drawing.Point(4, 22)
$tabPage3.Name = "tabPage3"
$tabPage3.Padding = New-Object System.Windows.Forms.Padding(3)
$tabPage3.Size = New-Object System.Drawing.Size(792, 398)
$tabPage3.TabIndex = 2
$tabPage3.Text = "Rapports"
$tabPage3.UseVisualStyleBackColor = $true
#
# tabPage4
#
$tabPage4.Location = New-Object System.Drawing.Point(4, 22)
$tabPage4.Name = "tabPage4"
$tabPage4.Padding = New-Object System.Windows.Forms.Padding(3)
$tabPage4.Size = New-Object System.Drawing.Size(792, 398)
$tabPage4.TabIndex = 3
$tabPage4.Text = "Import"
$tabPage4.UseVisualStyleBackColor = $true
#
# tabPage5
#
$tabPage5.Location = New-Object System.Drawing.Point(4, 22)
$tabPage5.Name = "tabPage5"
$tabPage5.Padding = New-Object System.Windows.Forms.Padding(3)
$tabPage5.Size = New-Object System.Drawing.Size(792, 398)
$tabPage5.TabIndex = 4
$tabPage5.Text = "Audit"
$tabPage5.UseVisualStyleBackColor = $true
#
# LresultsMove
#
$LresultsMove.HideSelection = $false
$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
# #
# FMain # FMain
# #
$FMain.BackColor = [System.Drawing.SystemColors]::ControlText $FMain.BackColor = [System.Drawing.SystemColors]::ControlText
$FMain.ClientSize = New-Object System.Drawing.Size(800, 450) $FMain.ClientSize = New-Object System.Drawing.Size(800, 450)
$FMain.Controls.Add($label2) $FMain.Controls.Add($tabs)
$FMain.Controls.Add($label1)
$FMain.Controls.Add($progressBar1)
$FMain.Controls.Add($CBdestSite)
$FMain.Controls.Add($CBsourceSite)
$FMain.Controls.Add($Bgo)
$FMain.Controls.Add($menuStrip1) $FMain.Controls.Add($menuStrip1)
$FMain.ForeColor = [System.Drawing.Color]::Snow $FMain.ForeColor = [System.Drawing.Color]::Black
$FMain.MainMenuStrip = $menuStrip1 $FMain.MainMenuStrip = $menuStrip1
$FMain.Name = "FMain" $FMain.Name = "FMain"
$FMain.Text = "SharePoint Mover GUI" $FMain.Text = "SharePoint Manager GUI"
$CBsourceSite.SelectedIndex = 0 function OnFormClosing_FMain{
$CBtargetSite.SelectedIndex = 0 # $this parameter is equal to the sender (object)
# $_ is equal to the parameter e (eventarg)
$MConnexionSharepoint.add_click({ # The CloseReason property indicates a reason for the closure :
# if (($_).CloseReason -eq [System.Windows.Forms.CloseReason]::UserClosing)
#Sets the value indicating that the event should be canceled.
($_).Cancel= $False
}
Connect-PnPOnline -Url $tenantURL -Interactive $FMain.Add_FormClosing( { OnFormClosing_FMain} )
###############On recupere puis stocke la liste des sites dans les box
$ComboboxList = (Get-SPOSite | Select Url).name
$CBsourceSite.Items.AddRange($ComboboxList)
$ComboboxList = (Get-SPOSite | Select Url).name $FMain.Add_Shown({$FMain.Activate()})
$CBtargetSite.Items.AddRange($ComboboxList) $ModalResult=$FMain.ShowDialog()
############### # Libération de la Form
$FMain.Dispose()
})
$Bgo.add_click({
Move-PnPFile -SiteRelativeUrl $srcSite -TargetUrl $destSite -Force -AllowSchemaMismatch
})
$FMain.ShowDialog()