Maintain control of your Microsoft 365 data
Peano
Novice
Posts: 6 Liked: never
Joined: Sep 13, 2023 6:34 pm
Full Name: Peano GmbH
Contact:
Post
by Peano » Mar 01, 2024 3:16 pm
this post
How can I find out whether the SharePoint site is a main site or a subsite?
Code: Select all
$organization = Get-VBOOrganization -Name "xy.onmicrosoft.com"
$repoository = Get-VBORepository -Name "repName"
$siteCollections = Get-VBOEntityData -Organization $organization -Repository $repoository -Type Site
foreach ($siteCollection in $siteCollections) {
if ($siteCollection.Type == site) ..
if ($siteCollection.Type == subsite) ..
}
Mike Resseler
Product Manager
Posts: 8220 Liked: 1333 times
Joined: Feb 08, 2013 3:08 pm
Full Name: Mike Resseler
Location: Belgium
Contact:
Post
by Mike Resseler » Mar 01, 2024 3:21 pm
this post
Hi Peano,
For us a site is a site. I think it is better that you run queries against SharePoint Online itself to find out what type of site it is. We distinguish Sites / Site Collection / Personal Site (this last one I am not 100 percent certain off...)
Peano
Novice
Posts: 6 Liked: never
Joined: Sep 13, 2023 6:34 pm
Full Name: Peano GmbH
Contact:
Post
by Peano » Mar 04, 2024 8:32 am
this post
The aim of the action is to export the content of the pages from the Veeam backup, the Sites should retain their folder structure,
Is there another way for all data to retain its assignment?
Code: Select all
$organization = Get-VBOOrganization -Name "xy.onmicrosoft.com"
$repoository = Get-VBORepository -Name "MyRep"
$siteCollections = Get-VBOEntityData -Organization $organization -Repository $repoository -Type Site
$organization = Get-VBOOrganization -Name "xy.onmicrosoft.com"
$session = Start-VBOSharePointItemRestoreSession -ShowDeleted -ShowAllVersions -Organization $organization
$session = Get-VBOSharePointItemRestoreSession
$organization = Get-VESPOrganization -Session $session
$ExportPath = "A:\DataExport"
$Logfile = "$($ExportPath)\$($session.id).log"
# Webseiten Durchlaufen
foreach ($siteCollection in $siteCollections)
{
Add-content $Logfile -value "***********************Export start*************************************"
...
...Export Site... Workfine
...
foreach ($subsiteCollection in $siteCollection)
{
Add-content $Logfile -value "Export Start subsiteCollection: $($subsiteCollection.Title)"
try
{
# try to Export Subsite
$subsite = Get-VESPSite -Organization $organization -Name $subsiteCollection.Title
if($subsite)
{
$subsitecontents = Get-VESPDocumentLibrary -Site $subsite -Recurse
foreach ($subsitecontent in $subsitecontents)
{
Add-content $Logfile -value "subsitecontent: $($subsitecontent)"
if($subsitecontent)
{
$zielSub = "$ExportPath\$siteCollection\$subsitecontent"
Add-content $Logfile -value "Export subsitecontent: $($subsitecontent)"
# Daten exportieren
if (!(Test-Path $zielSub))
{
New-Item -ItemType "directory" $zielSub
$documentLibrary = Get-VESPDocumentLibrary -Site $subsite -Name $subsitecontent
Save-VESPItem -DocumentLibrary $documentLibrary -Path "$zielSub" -Force |Add-Content -Path $Logfile
}
else
{
Add-content $Logfile -value "subsitecontent vorhanden"
}
}
else
{
Add-content $Logfile -value "Wahrnung: content is null"
}
$subsitecontents = Get-VESPDocumentLibrary -Site $subsite -Recurse
foreach ($subsitecontent in $subsitecontents)
{
$zielSub = "$ExportPath\$($siteCollection.Name)\$($subsiteCollection.Name)\$($subsitecontent)"
if (!(Test-Path $zielSub))
{
New-Item -ItemType "directory" $zielSub
$documentLibrary = Get-VESPDocumentLibrary -Site $subsite -Name $content
Save-VESPItem -DocumentLibrary $documentLibrary -Path $zielSub -Force
}
}
}
}
}
catch
{
Add-content $Logfile -value "***********************ERROR*************************************"
Add-content $Logfile -value "$($siteCollection.Title);$($siteCollection.Url);;$($subsiteCollection.Title);$($subsiteCollection.Url);$($subsitecontent)"
Add-content $Logfile -value $_.Exception.Message
Add-content $Logfile -value "***********************ERROR*************************************"
Write-Host "ERROR"
}
Add-content $Logfile -value "Ende Start subsiteCollection: $($subsiteCollection.Title)"
}
Add-content $Logfile -value "***********************Export Ende*************************************"
}
Users browsing this forum: No registered users and 40 guests