Office 365 Video Portal est désormais remplacé par Office 365 Stream.
En revanche la migration de son contenu est pour le moment laissée au soin des clients, une solution de migration devrait arriver, mais aucune date n’est encore connue.
La situation demande quoi qu’il en soit une analyse du contenu pour savoir à quelle montagne on s’attaque et c’est le but de ce script.
Le script PowerShell suivant vous permet d’exporter en CSV les informations de chaque fichier placé dans un Channel Office 365 Video portal avec les details suivant:
- ChannelName
- ChannelURL
- ChannelStorageinMB
- FileTotal
- FileName
- FileType
- FileSizeMB
- FileAbsoluteURL
Vous pouvez de ce fait l’adapter ou l’utiliser comme bon vous semble et selon vos besoins.
function Invoke-RestSPO
{
Param(
[Parameter(Mandatory=$True)]
[String]$AdminPortalUrl,[Parameter(Mandatory=$True)]
[String]$SPOUrl,[Parameter(Mandatory=$True)]
[String]$UserName,[Parameter(Mandatory=$True)]
[String]$Password
)[string]$VideoListName = "Videos"
Add-Type -Path ([System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client").location)
Add-Type -Path ([System.Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint.Client.runtime").location)$SecurePassword = ConvertTo-SecureString -string (Get-Content $Password)
$creds = New-Object System.Management.Automation.PSCredential -ArgumentList $username, $SecurePassword
#$creds = Get-Credential$SPOQueryUrl= $SPOUrl + "/_api/search/query?querytext=%27contentclass:sts_site WebTemplate:POINTPUBLISHINGTOPIC%27&SelectProperties=%27Sitename%27&rowlimit=5000"
Write-Host "Performing the SPO Search Query to get all the Office 365 Video Channels..." -ForegroundColor Green
$request = [System.Net.WebRequest]::Create($SPOQueryUrl)
$request.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($creds.UserName,$creds.Password)
$request.Headers.Add("X-FORMS_BASED_AUTH_ACCEPTED", "f")
$request.Accept = "application/json;odata=verbose"
#$request.Method=$Method
$request.Method=[Microsoft.PowerShell.Commands.WebRequestMethod]::Get
$response = $request.GetResponse()
$requestStream = $response.GetResponseStream()
$readStream = New-Object System.IO.StreamReader $requestStream
$data=$readStream.ReadToEnd()
$results = $data | ConvertFrom-Json
$N4result=$results.d.query.PrimaryQueryResult.RelevantResults.Table.Rows.results.Cells.results
$Channels = @()
foreach($r in $N4result){
If($r.Key -eq "SiteName")
{
$Channels +=$r.Value
}
}Write-Host "Collecting the Office 365 Video Channel Storage Details..." -ForegroundColor Green
Connect-SPOService -Url $AdminPortalUrl -Credential $creds$data=@()
Write-Host
Write-Host "Office 365 Video Channel Storage Details:" -ForegroundColor Green
Write-Host "-----------------------------------------" -ForegroundColor Green
Write-Host
foreach($chname in $Channels)
{
Write-Host " --------------------------------------------------------------------------- "
Write-Host "Channel URL :", $chname
$site = Get-SPOSite -Identity $chname -Detailed
$ctx=New-Object Microsoft.SharePoint.Client.ClientContext($site.URL)
#$creds = New-Object System.Management.Automation.PSCredential -ArgumentList ($Username, $AdminPassword)
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($creds.UserName,$creds.Password)
$ctx.RequestTimeout = 1000000 # milliseconds
$spoweb = $ctx.Web
$ctx.Load($spoweb)
$ctx.ExecuteQuery()
Write-Host
#write-host "Channel Name :", $spoweb.Title
#Write-Host "Site collection Url :", $ctx.Url #-BackgroundColor White -ForegroundColor DarkGreen
Write-Host "Channel Name :", $site.Title -foregroundcolor Green
Write-Host "Channel URL :", $site.URL -foregroundcolor Yellow
Write-Host "ChannelStorageinMB :", $site.StorageUsageCurrent -foregroundcolor Yellow
write-host "Total Files :", $ListItems.Count -foregroundcolor Yellow$MyVideoslist = $spoweb.Lists.GetByTitle($VideoListName)
$ListItems = $MyVideoslist.GetItems([Microsoft.SharePoint.Client.CamlQuery]::CreateAllItemsQuery())
$ctx.Load($ListItems)
$ctx.ExecuteQuery()foreach($MyListItem in $ListItems)
{
$datum = New-Object -TypeName PSObject
Write-Host " > file:", $MyListItem["Title"], "- FileType:", $MyListItem["File_x0020_Type"], "- Size (MB):", ([math]::round(($MyListItem["File_x0020_Size"]/(1024*1024)), 2)), "- FileURL:", $($MyListItem["FileDirRef"] +"/"+ $MyListItem["FileLeafRef"])
$datum | Add-Member -MemberType NoteProperty -Name ChannelName -Value $site.Title
$datum | Add-Member -MemberType NoteProperty -Name ChannelURL -Value $site.URL
$datum | Add-Member -MemberType NoteProperty -Name ChannelStorageinMB -Value $site.StorageUsageCurrent
$datum | Add-Member -MemberType NoteProperty -Name FileTotal -Value $ListItems.Count
$datum | Add-Member -MemberType NoteProperty -Name FileName -Value $MyListItem["Title"]
$datum | Add-Member -MemberType NoteProperty -Name FileType -Value $MyListItem["File_x0020_Type"]
$datum | Add-Member -MemberType NoteProperty -Name FileSizeMB -Value ([math]::round(($MyListItem["File_x0020_Size"]/(1024*1024)), 2))
$datum | Add-Member -MemberType NoteProperty -Name FileAbsoluteURL -Value $($MyListItem["FileDirRef"] +"/"+ $MyListItem["FileLeafRef"])
$data += $datum
}
#Write-Host "StorageQuotainGB :", ($site.StorageQuota/1024) -foregroundcolor Green
#Write-Host "StorageQuotaWarningLevelinGB :", ($site.StorageQuotaWarningLevel/1024) -foregroundcolor Green
Write-Host ""
Write-Host " --------------------------------------------------------------------------- "
}$datestring = (get-date).ToString("yyyyMMdd-hhmm")
$fileName = ("C:\VideoPortal\VideoPortalDetails_" + $datestring + ".csv")
Write-host " -----------------------------------------" -ForegroundColor Green
Write-Host (" >>> writing to file {0}" -f $fileName) -ForegroundColor Green
$data | Export-csv $fileName -NoTypeInformation
Write-host " -----------------------------------------" -ForegroundColor Green
}
[string]$username = "admin@yourtenant.onmicrosoft.com"
[string]$PwdTXTPath = "C:\SECUREDPWD\ExportedPWD-$($username).txt"# Get needed information from end user
[string]$SPOAdminPortal = "https://yourtenant-admin.sharepoint.com"
[string]$SPOSiteURL = "https://yourtenant.sharepoint.com"Invoke-RestSPO -AdminPortalUrl $SPOAdminPortal -SPOUrl $SPOSiteURL -UserName $username -Password $PwdTXTPath
Vous aurez alors la possibilité d’importer les détails dans un fichier Excel.
Vous pourrez alors avoir une meilleure idée de la tache à accomplir en migration ou intégration.
Romelard Fabrice
Version anglaise:
Informations additionnelles:
- https://community.spiceworks.com/how_to/127063-how-to-check-channel-storage-space-in-office-365-vide...
- http://www.jijitechnologies.com/blogs/how-to-get-the-storage-used-in-all-office365-video-channels
- https://gallery.technet.microsoft.com/office/How-To-Check-Channel-ac2a9b34
- https://gallery.technet.microsoft.com/office/Export-all-Office-365-53f8105b
Commentaires
Enregistrer un commentaire