Lors des migrations de Sites SharePoint 2007, un point particulièrement pénible est lié aux fichiers bloqués en mode “Checked Out” voir jamais “Checked In” (cas des listes avec métadonnées obligatoires non renseignées).
Ces petits scripts PowerShell peuvent être utilisés pour vous débloquer cette situation avec les deux fonctions suivantes:
Devenir le propriétaire de tous les fichiers en attente de Check In:
function CheckOuttoAdmin([string]$WebURL, [string]$LibraryName)
{
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null
Write-Host " -------------------------------------------------------- "
Write-Host "SPWeb URL to configure:", $WebURL -foregroundcolor Red
$site = new-object Microsoft.SharePoint.SPSite($WebURL)
$web = $site.openweb()
Write-Host " >> SPWeb URL from Object:", $web.URL -foregroundcolor Green
$getLib = $web.Lists[$LibraryName]
$getLib.CheckedOutFiles | %{
Write-Host "Taking over Checkout $($_.LeafName)"
$myFile = $_
$myFile.TakeOverCheckOut()
}$web.Dispose()
$site.Dispose()
}CheckOuttoAdmin "http://YourSP2007WebApp/sites/YourSiteCollection" "Your Document Library Name"
Forcer le Check-in de tous les fichiers encore en mode “Checked Out”:
function CheckInDocument([string]$WebURL, [string]$LibraryName)
{
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint") > $null
Write-Host " -------------------------------------------------------- "
Write-Host "SPWeb URL to configure:", $WebURL -foregroundcolor Red
$site = new-object Microsoft.SharePoint.SPSite($WebURL)
$web = $site.openweb()
Write-Host " >> SPWeb URL from Object:", $web.URL -foregroundcolor Green$getLib = $web.Lists[$LibraryName]
$getLib.CheckedOutFiles | %{
Write-Host "Checked Out file: $($_.LeafName)"
$myCheckedOutFile = $_
Write-Host " >>>>>>ExactURL:", $myCheckedOutFile.DirName #"sites/boss-site"$myExactFolderName = $myCheckedOutFile.DirName.SubString(16) #//This is //to get the exact folder path without the /sites/sitename, this number may //be different for you
Write-Host " >>>>> ExactURL:", $myExactFolderName$getFolder = $web.GetFolder($myExactFolderName)
$getFolder.Files | Where { $_.CheckOutStatus -ne "None" } | ForEach {
Write-Host "$($_.Name) is Checked out To: $($_.CheckedOutBy)"
$_.CheckIn("Checked In By Administrator")
Write-Host "$($_.Name) Checked In" -ForeGroundColor Green
}
}
$web.Dispose()
$site.Dispose()
}CheckInDocument "http://YourSP2007WebApp/sites/YourSiteCollection" "Your Document Library Name"
Il ne vous reste plus qu’à adapter les deux scripts à vos propres configurations et ensuite lancer la migration des contenus avec votre outil de migration préféré.
Fabrice Romelard [MBA]
Sources de référence:
Commentaires
Enregistrer un commentaire