2024-03-07 21:14:50 +01:00
|
|
|
################################################################################
|
|
|
|
#
|
|
|
|
# Name : SharePoint Mover
|
|
|
|
# Version : 0.1
|
|
|
|
# Author :
|
|
|
|
# Date : 07/03/2024
|
|
|
|
#
|
|
|
|
# Generated with ConvertForm module version 2.0.0
|
|
|
|
# PowerShell version 7.4.1
|
|
|
|
#
|
|
|
|
# Invocation Line : Convert-Form -Path $Source -Destination $Destination -Encoding ascii -force
|
|
|
|
# Source : C:\Users\SebastienQUEROL\source\repos\sharepointmover-gui\Form1.Designer.cs
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
function Get-ScriptDirectory
|
|
|
|
{ #Return the directory name of this script
|
|
|
|
$Invocation = (Get-Variable MyInvocation -Scope 1).Value
|
|
|
|
Split-Path $Invocation.MyCommand.Path
|
2024-03-06 18:02:52 +01:00
|
|
|
}
|
|
|
|
|
2024-03-07 21:14:50 +01:00
|
|
|
$ScriptPath = Get-ScriptDirectory
|
|
|
|
|
|
|
|
# Chargement des assemblies externes
|
|
|
|
Add-Type -AssemblyName System.Windows.Forms
|
|
|
|
Add-Type -AssemblyName System.Drawing
|
|
|
|
|
|
|
|
$FMain = New-Object System.Windows.Forms.Form
|
|
|
|
|
|
|
|
$components = New-Object System.ComponentModel.Container
|
|
|
|
$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
|
|
|
|
$MQuestionApropos = New-Object System.Windows.Forms.ToolStripMenuItem
|
|
|
|
$MQuestionWiki = New-Object System.Windows.Forms.ToolStripMenuItem
|
|
|
|
$Bgo = New-Object System.Windows.Forms.Button
|
2024-03-07 22:42:03 +01:00
|
|
|
$CBsourceSite = New-Object System.Windows.Forms.ComboBox
|
|
|
|
$CBdestSite = New-Object System.Windows.Forms.ComboBox
|
2024-03-07 21:14:50 +01:00
|
|
|
$progressBar1 = New-Object System.Windows.Forms.ProgressBar
|
|
|
|
$sourceInfo = New-Object System.Windows.Forms.ToolTip($components)
|
|
|
|
$label1 = New-Object System.Windows.Forms.Label
|
|
|
|
$label2 = New-Object System.Windows.Forms.Label
|
|
|
|
#
|
|
|
|
# menuStrip1
|
|
|
|
#
|
|
|
|
$menuStrip1.Items.AddRange(@(
|
|
|
|
$Mconnexion,
|
|
|
|
$Mquestion))
|
|
|
|
$menuStrip1.Location = New-Object System.Drawing.Point(0, 0)
|
|
|
|
$menuStrip1.Name = "menuStrip1"
|
|
|
|
$menuStrip1.Size = New-Object System.Drawing.Size(800, 24)
|
|
|
|
$menuStrip1.TabIndex = 0
|
|
|
|
$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.DropDownItems.AddRange(@(
|
|
|
|
$MQuestionApropos,
|
|
|
|
$MQuestionWiki))
|
|
|
|
$Mquestion.Name = "Mquestion"
|
|
|
|
$Mquestion.Size = New-Object System.Drawing.Size(24, 20)
|
|
|
|
$Mquestion.Text = "?"
|
|
|
|
#
|
|
|
|
# MQuestionApropos
|
|
|
|
#
|
|
|
|
$MQuestionApropos.Name = "MQuestionApropos"
|
|
|
|
$MQuestionApropos.Size = New-Object System.Drawing.Size(131, 22)
|
|
|
|
$MQuestionApropos.Text = "A propos..."
|
|
|
|
#
|
|
|
|
# MQuestionWiki
|
|
|
|
#
|
|
|
|
$MQuestionWiki.Name = "MQuestionWiki"
|
|
|
|
$MQuestionWiki.Size = New-Object System.Drawing.Size(131, 22)
|
|
|
|
$MQuestionWiki.Text = "Wiki"
|
|
|
|
#
|
|
|
|
# Bgo
|
|
|
|
#
|
|
|
|
$Bgo.ForeColor = [System.Drawing.Color]::White
|
|
|
|
$Bgo.Location = New-Object System.Drawing.Point(688, 155)
|
|
|
|
$Bgo.Name = "Bgo"
|
|
|
|
$Bgo.Size = New-Object System.Drawing.Size(75, 23)
|
|
|
|
$Bgo.TabIndex = 1
|
|
|
|
$Bgo.Text = "GO"
|
|
|
|
$Bgo.UseVisualStyleBackColor = $true
|
|
|
|
#
|
2024-03-07 22:42:03 +01:00
|
|
|
# CBsourceSite
|
2024-03-07 21:14:50 +01:00
|
|
|
#
|
2024-03-07 22:42:03 +01:00
|
|
|
$CBsourceSite.ForeColor = [System.Drawing.Color]::White
|
|
|
|
$CBsourceSite.FormattingEnabled = $true
|
|
|
|
$CBsourceSite.Location = New-Object System.Drawing.Point(27, 131)
|
|
|
|
$CBsourceSite.Name = "CBsourceSite"
|
|
|
|
$CBsourceSite.Size = New-Object System.Drawing.Size(587, 21)
|
|
|
|
$CBsourceSite.TabIndex = 2
|
2024-03-07 21:14:50 +01:00
|
|
|
#
|
2024-03-07 22:42:03 +01:00
|
|
|
# CBdestSite
|
2024-03-07 21:14:50 +01:00
|
|
|
#
|
2024-03-07 22:42:03 +01:00
|
|
|
$CBdestSite.ForeColor = [System.Drawing.Color]::White
|
|
|
|
$CBdestSite.FormattingEnabled = $true
|
|
|
|
$CBdestSite.Location = New-Object System.Drawing.Point(27, 182)
|
|
|
|
$CBdestSite.Name = "CBdestSite"
|
|
|
|
$CBdestSite.Size = New-Object System.Drawing.Size(587, 21)
|
|
|
|
$CBdestSite.TabIndex = 3
|
2024-03-07 21:14:50 +01:00
|
|
|
#
|
|
|
|
# progressBar1
|
|
|
|
#
|
|
|
|
$progressBar1.Location = New-Object System.Drawing.Point(12, 345)
|
|
|
|
$progressBar1.Name = "progressBar1"
|
|
|
|
$progressBar1.Size = New-Object System.Drawing.Size(776, 23)
|
|
|
|
$progressBar1.TabIndex = 4
|
|
|
|
#
|
|
|
|
# label1
|
|
|
|
#
|
|
|
|
$label1.AutoSize = $true
|
|
|
|
$label1.Location = New-Object System.Drawing.Point(27, 112)
|
|
|
|
$label1.Name = "label1"
|
|
|
|
$label1.Size = New-Object System.Drawing.Size(62, 13)
|
|
|
|
$label1.TabIndex = 5
|
|
|
|
$label1.Text = "Site Source"
|
|
|
|
#
|
|
|
|
# label2
|
|
|
|
#
|
|
|
|
$label2.AutoSize = $true
|
|
|
|
$label2.Location = New-Object System.Drawing.Point(27, 166)
|
|
|
|
$label2.Name = "label2"
|
|
|
|
$label2.Size = New-Object System.Drawing.Size(81, 13)
|
|
|
|
$label2.TabIndex = 6
|
|
|
|
$label2.Text = "Site Destination"
|
|
|
|
#
|
|
|
|
# FMain
|
|
|
|
#
|
|
|
|
$FMain.BackColor = [System.Drawing.SystemColors]::ControlText
|
|
|
|
$FMain.ClientSize = New-Object System.Drawing.Size(800, 450)
|
|
|
|
$FMain.Controls.Add($label2)
|
|
|
|
$FMain.Controls.Add($label1)
|
|
|
|
$FMain.Controls.Add($progressBar1)
|
2024-03-07 22:42:03 +01:00
|
|
|
$FMain.Controls.Add($CBdestSite)
|
|
|
|
$FMain.Controls.Add($CBsourceSite)
|
2024-03-07 21:14:50 +01:00
|
|
|
$FMain.Controls.Add($Bgo)
|
|
|
|
$FMain.Controls.Add($menuStrip1)
|
|
|
|
$FMain.ForeColor = [System.Drawing.Color]::Snow
|
|
|
|
$FMain.MainMenuStrip = $menuStrip1
|
|
|
|
$FMain.Name = "FMain"
|
|
|
|
$FMain.Text = "SharePoint Mover GUI"
|
|
|
|
|
2024-03-07 22:42:03 +01:00
|
|
|
$CBsourceSite.SelectedIndex = 0
|
|
|
|
$CBtargetSite.SelectedIndex = 0
|
2024-03-07 21:14:50 +01:00
|
|
|
|
2024-03-07 22:42:03 +01:00
|
|
|
$MConnexionSharepoint.add_click({
|
|
|
|
|
|
|
|
|
|
|
|
Connect-PnPOnline -Url $tenantURL -Interactive
|
|
|
|
###############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
|
|
|
|
$CBtargetSite.Items.AddRange($ComboboxList)
|
|
|
|
###############
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
$Bgo.add_click({
|
|
|
|
|
|
|
|
Move-PnPFile -SiteRelativeUrl $srcSite -TargetUrl $destSite -Force -AllowSchemaMismatch
|
|
|
|
|
|
|
|
})
|
2024-03-07 21:14:50 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$FMain.ShowDialog()
|