Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
function Set-SPOListVersioning($EnableVersioning, $Urelek)
{
$ctx=New-Object Microsoft.SharePoint.Client.ClientContext($urelek)
$ctx.Credentials = New-Object Microsoft.SharePoint.Client.SharePointOnlineCredentials($username, $Adminpassword)
$ctx.Load($ctx.Web.Lists)
$ctx.Load($ctx.Web)
$ctx.Load($ctx.Web.Webs)
$ctx.ExecuteQuery()
Write-Host
Write-Host $ctx.Url -BackgroundColor White -ForegroundColor DarkGreen
foreach( $ll in $ctx.Web.Lists)
{
$ll.EnableVersioning = $EnableVersioning
$ll.Update()
$csvvalue= new-object PSObject
$listurl=$null
if($ctx.Url.EndsWith("/")) {$listurl= $ctx.Url+$ll.Title}
else {$listurl=$ctx.Url+"/"+$ll.Title}
$csvvalue | Add-Member -MemberType NoteProperty -Name "Url" -Value ($listurl)
$csvvalue | Add-Member -MemberType NoteProperty -Name "Status" -Value "Failed"
try
{
$ErrorActionPreference="Stop"
$ctx.ExecuteQuery()
Write-Host $listurl -ForegroundColor DarkGreen
$csvvalue.Status="Success"
$Global:csv+= $csvvalue
}

catch
{
$Global:csv+= $csvvalue
Write-Host $listurl -ForegroundColor Red
}
finally
{$ErrorActionPreference="Continue"}


}

if($ctx.Web.Webs.Count -gt 0)
{
for($i=0; $i -lt $ctx.Web.Webs.Count ; $i++)
{
Set-SPOListVersioning -EnableVersioning $EnableVersioning -Urelek ($ctx.Web.Webs[$i].Url)
}

}



}






# Paths to SDK. Please verify location on your computer.
Add-Type -Path "c:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SharePoint.Client\v4.0_16.0.0.0__71e9bce111e9429c\Microsoft.SharePoint.Client.dll"
Add-Type -Path "c:\Windows\Microsoft.NET\assembly\GAC_MSIL\Microsoft.SharePoint.Client.Runtime\v4.0_16.0.0.0__71e9bce111e9429c\Microsoft.SharePoint.Client.Runtime.dll"

# Insert the credentials and the name of the admin site
$Username="t@trial765.onmicrosoft.com"
$AdminPassword=Read-Host -Prompt "Password" -AsSecureString
Connect-SPOService https://trial765-admin.sharepoint.com -Credential $Username
$myhost="https://trial765-my.sharepoint.com"

# If you do not want to target all users, enter the target user names in the line below instead of Get-SPOUser cmdlet:
$users=get-SPOUser -Site $myhost
$EnableVersioning=$true
$Global:csv=@()

foreach($user in $users)
{


if($user.LoginName.Contains('@'))
{
$persweb=$user.LoginName.Replace(".","_").Replace("@","_")
$persweb=$myhost+"/personal/"+$persweb
Write-Host $persweb

$AdminUrl=$persweb

#Add the following line if you want to assign yourself, administrator or another user access to other users' personal sites
#Set-SPOUser -Site $AdminUrl -IsSiteCollectionAdmin $true -LoginName t@trial765.onmicrosoft.com
Set-SPOListVersioning -EnableVersioning $EnableVersioning -Urelek $AdminUrl
}
}

# Specify the path where the log file will be published
$Global:csv | Export-Csv -Path C:\Users\Public\Versioning.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Powershell script that enables versioning for all the libraries and lists in all personal sites (OneDrive for Business).

It requires SharePoint Online Management Shell and SharePoint SDK installed:

http://technet.microsoft.com/en-us/library/fp161372(v=office.15).aspx

http://www.microsoft.com/en-us/download/details.aspx?id=30722



It uses recurrence to find all sites in all site collections and then goes through all the lists.

For some lists, enabling version may not be possible and you will receive a notification of that.

At the end, a csv file is generated with the lists' urls and the status whether enabling was successful or not.



As the script runs you will see green lists' titles for which the enabling succeeded and red for those which failed (not all lists support versioning).
<img src="../Enable versioning for all lists in OneDrive sites/Capture204.PNG" width="850">



You can customize the script by using the commented out tips.


65 changes: 0 additions & 65 deletions Remove SPO subsite/Remove SPO subsite.ps1

This file was deleted.

15 changes: 0 additions & 15 deletions Remove SPO subsite/description.md

This file was deleted.

File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ At the end, a csv file is generated with the lists' urls and the status whether


As the script runs you will see green lists' titles for which the enabling succeeded and red for those which failed (not all lists support versioning).

<img src="../Enable versioning for all lists in OneDrive sites/Capture204.PNG" width="850">



Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,31 @@
.
A short script that enables versioning for all the libraries and lists in the whole tenant.

It requires SharePoint Online Management Shell and SharePoint SDK installed:

http://technet.microsoft.com/en-us/library/fp161372(v=office.15).aspx

http://www.microsoft.com/en-us/download/details.aspx?id=30722



It uses recurrence to find all sites in all site collections and then goes through all the lists.

For some lists, enabling version may not be possible and you will receive a notification of that.

At the end, a csv file is generated with the lists' urls and the status whether enabling was successful or not.



As the script runs you will see green lists' titles for which the enabling succeeded and red for those which failed (not all lists support versioning).


<img src="../PS Enable versioning for all SharePoint Online lists/versioningPS2.PNG" width="850">

<img src="../PS Enable versioning for all SharePoint Online lists/versioningPS.PNG" width="850">

<img src="../PS Enable versioning for all SharePoint Online lists/versioningPS3.PNG" width="850">

You can customize the script by using the commented out tips.

<br/><br/>
<b>Enjoy and please share feedback!</b>

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ $versioning = $true

# You can also enter credentials directly: $siteUrl="https://tenant-admin.sharepoint.com"
$siteUrl = Read-Host -Prompt "Enter https://tenant-admin.sharepoint.com”
$username = Read-Host -Prompt "Enter admin's login, e.g. admin@domain.onmicrosoft.com"
$username = Read-Host -Prompt "Enter admin login, e.g. admin@domain.onmicrosoft.com"
$password = Read-Host -Prompt "Enter password" -AsSecureString
$credy= New-Object System.Management.Automation.PSCredential($username,$password)
Connect-SPOService -Credential $credy -Url $siteUrl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
{
param (
[Parameter(Mandatory=$true,Position=1)]
[string]$Username,
[Parameter(Mandatory=$true,Position=2)]
[string]$Username,
[Parameter(Mandatory=$true,Position=2)]
[string]$Url,
[Parameter(Mandatory=$true,Position=3)]
$password,
Expand All @@ -20,9 +20,9 @@ param (
$ctx.Load($ll)
$ctx.ExecuteQuery()
$spqQuery = New-Object Microsoft.SharePoint.Client.CamlQuery
$spqQuery.ViewXml ="<View Scope='RecursiveAll' />";
$itemki=$ll.GetItems($spqQuery)
$ctx.Load($itemki)
$spqQuery.ViewXml ="<View Scope='RecursiveAll' />";
$itemki=$ll.GetItems($spqQuery)
$ctx.Load($itemki)
$ctx.ExecuteQuery()

foreach($item in $itemki)
Expand Down Expand Up @@ -61,13 +61,14 @@ param (
}
if($file.Versions[($file.Versions.Count-1)].IsCurrentVersion)
{
$vLabel=$file.Versions[($file.Versions.Count-2)].VersionLabel
Write-Host "Version to be restored: " $vLabel
$vLabel=$file.Versions[($file.Versions.Count-2)].VersionLabel
Write-Host "Version to be restored: " $vLabel
}
else{ $vLabel=$file.Versions[($file.Versions.Count-1)].VersionLabel
Write-Host "Version to be restored: " $vLabel }
$file.Versions.RestoreByLabel($vLabel)
$ctx.ExecuteQuery()
else{
$vLabel=$file.Versions[($file.Versions.Count-1)].VersionLabel
Write-Host "Version to be restored: " $vLabel }
$file.Versions.RestoreByLabel($vLabel)
$ctx.ExecuteQuery()
}

else
Expand Down
Loading