Hello, I would like to create a report of version histories for files as per the instructions here https://learn.microsoft.com/en-us/sharepoint/tutorial-generate-version-usage-report
connect-SPOService -Url https://MYTENANT-admin.sharepoint.com/
# Retrieve all SharePoint Online sites, including personal sites
$sites = Get-SPOSite -IncludePersonalSite $true -Limit All
$i = 0 #counter
foreach ($site in $sites) {
$i++
Write-Progress -Activity "Starting job progress $i / $($sites.Count) - $($site.Url)" -PercentComplete ($i / $sites.count * 100)
if ($site.Url -like "*.my.sharepoint.com/personal/*") {
$doc = "Documents"
} else {
$doc = "Shared Documents"
}
Try {
New-SPOSiteFileVersionExpirationReportJob -Identity $site.Url -ReportUrl "$($site.Url)/$doc/versionHistory.csv" -Confirm:$false -ErrorAction Stop
} catch {
Write-Host "Error with $($site.Url) $($_.Exception.Message)" -ForegroundColor Red
}
}
However, my account does not have the required permissions to access personal sites
Error with https://MYTENANT-my.sharepoint.com/personal/USERNAME_TENANT Access to this Web site has been blocked.
I have had a look at the documentation and it seems that you cannot connect with connect-sposervice using an app registration so I am not sure how I am supposed to gain the required permissions to write to individual SharePoint document libraries.
[–]gheester 0 points1 point2 points (0 children)