In this article, we will see how to change the list level settings, which allows users having read permission see the items with minor versions, using UI and PowerShell script.
We had a recent request from the customer to do it for all the lists and manually doing it for all the lists is not possible and we are left with PowerShell. Let’s explore both the options to make the change.
Option 1
Change the setting using UI
Please navigate to the list/library and click on list/library settings on top ribbon and change the setting, as highlighted in the screenshot given below.
Option 2
Using PowerShell
PowerShell script given below is just for one list.
- #-------------------------------------------------------------------------------------------------
- $WebURL = Read-Host “Please provide the site URL”
- $Web = Get-SPWeb $webURL
- $List = $Web.lists[“Documents”]
- $List.Draftversionvisibility = 0
- # Note: Reader = 0, Author =1, Approver = 2
- $List.update();
- $web.Dispose();
- #-----------------------------------------------------------------------------------------------------------------------
- The below PowerShell script includes all the lists in all the subsites within a site collection.
-
- $SiteURL = "http:
- $Site = Get-SPSite $SiteURL
- foreach($Web in $Site.AllWebs)
- {
- $ListsToUpdate = @()
- foreach($list in $web.lists)
- {
- $ListsToUpdate += $list.Title
- }
- foreach($listToUpdate in $ListsToUpdate)
- {
- $List = $Web.Lists[$listToUpdate]
- #Set the Draft Version Visibility. 0 = Reader, 1 = Author, 2 = Approver
- $List.DraftVersionVisibility = 0
- $List.Update()
- }
- $Web.Dispose()
- }
Thank you for reading.