In this article, we will discuss the configuration of some of the important List Settings for SharePoint Online Lists. I have taken only a handful of operations to showcase in this demo, but remember there are a lot more to explore.
Operation: How to enable “New Folder” Menu Command
We can see this setting available under “Advanced Settings” for the list, as shown below.
We can play with this setting using PowerShell as described below.
In Step 1, we will get the object reference to the respective list by calling “GetByTitle” method.
In Step 2, we will set “EnableFolderCreation” to True.
In Step 3, we will update the list property by calling the “Update” method.
In Step 4, we will send the batch request to SharePoint Server for processing by calling “ExecuteQuery” method.
In Step 5, we will display a success message to the Users if Step 4 executes successfully.
In Step 6, we will call a function that we have explained in Step 1-5.
Once this script executes successfully, we can see the list setting updated by navigating “Advanced Settings” of the list as shown below.
Operation: How to disable “List Item Attachments” Option
We can see this setting available under “Advanced Settings” for the list as shown below.
We can play with this setting using PowerShell as described below.
In Step 1, we will get the object reference to the respective list by calling “GetByTitle” method.
In Step 2, we will set “EnableAttachments” to False.
In Step 3, we will update the list property by calling the “Update” method.
In Step 4, we will send the batch request to SharePoint Server for processing by calling “ExecuteQuery” method.
In Step 5, we will display a success message to the Users if Step 4 executes successfully.
In Step 6, we will call the function that we have explained in Step 1-5.
Once this script executes successfully, we can see the list setting updated by navigating “Advanced Settings” of the list, as shown below.
Operation: How to enable “Quick Launch” Option for List
We can see this setting available under “General Settings” for the list as shown below.
We can play with this setting using PowerShell, as described below.
In Step 1, we will get the object reference to the respective list by calling “GetByTitle” method.
In Step 2, we will set “OnQuickLaunch” to True.
In Step 3, we will update the list property by calling “Update” method.
In Step 4, we will send the batch request to SharePoint Server for processing by calling “ExecuteQuery” method.
In Step 5, we will display a success message to the Users if Step 4 executes successfully.
In Step 6, we will call the function that we have explained in Step 1-5.
Once this script executes successfully, we can see list setting updated by navigating “General Settings” of the list, as shown below.
Operation: How to enable “Version History” for List Item Attachments
We can see this setting available under “Versioning Settings” for the list, as shown below.
We can play with this setting using PowerShell as described below.
In Step 1, we will get the object reference to the respective list by calling “GetByTitle” method.
In Step 2, we will set “EnableVersioning” to True.
In Step 3, we will update the list property by calling “Update” method.
In Step 4, we will send the batch request to SharePoint Server for processing by calling “ExecuteQuery” method.
In Step 5, we will display a success message to the Users if Step 4 executes successfully.
In Step 6, we will call the function that we have explained in Step 1-5.
Once this script executes successfully, we can see list setting updated by navigating “Versioning Settings” of the list, as shown below.
We may work on additional version settings as well as shown below.
For example, let us try to enable Minor versions for a document library “ProductDesigns” by using PowerShell.
In Step 1, we will get the object reference to the respective list by calling “GetByTitle” method.
In Step 2, we will set “EnableMinorVersions” to True.
In Step 3, we will update the list property by calling “Update” method.
In Step 4, we will send the batch request to SharePoint Server for processing by calling “ExecuteQuery” method.
In Step 5, we will display a success message to the Users if Step 4 executes successfully.
In Step 6, we will call the function that we have explained in Step 1-5.
Once this script executes successfully, we can see list setting updated by navigating “Versioning Settings” of the list as shown below.
Operation: How to enable “Require Check Out” Option
We can see this setting available under “Versioning Settings” for the list as shown below.
We can play with this setting using PowerShell as described below.
In Step 1, we will get the object reference to the respective list by calling “GetByTitle” method.
In Step 2, we will set “ForceCheckOut” to True.
In Step 3, we will update the list property by calling “Update” method.
In Step 4, we will send the batch request to SharePoint Server for processing by calling “ExecuteQuery” method.
In Step 5, we will display a success message to the Users if Step 4 executes successfully.
In Step 6, we will call the function that we have explained in Step 1-5.
Once this script executes successfully, we can see list setting updated by navigating “Versioning Settings” of the list, as shown below.
Operation: How to enable “Require Content Approval” Option
We can see this setting available under “Versioning Settings” for the list as shown below.
We can play with this setting using PowerShell as described below.
In Step 1, we will get the object reference to the respective list by calling “GetByTitle” method.
In Step 2, we will set “EnableModeration” to True.
In Step 3, we will update the list property by calling “Update” method.
In Step 4, we will send the batch request to SharePoint Server for processing by calling “ExecuteQuery” method.
In Step 5, we will display a success message to the Users if Step 4 executes successfully.
In Step 6, we will call the function that we have explained in Step 1-5.
Once this script executes successfully, we can see list setting updated by navigating “Versioning Settings” of the list as shown below.
Operation: How to configure “Draft Item Security” Option
We can see this setting available under “Versioning Settings” for the list as shown below.
We can play with this setting using PowerShell as described below.
In Step 1, we will get the object reference to the respective list by calling “GetByTitle” method.
In Step 2, we will set “DraftVersionVisibility” as “Approver”. This setting will limit access to the draft items for the Approvers only.
In Step 3, we will update the list property by calling the “Update” method.
In Step 4, we will send the batch request to SharePoint Server for processing by calling “ExecuteQuery” method.
In Step 5, we will display a success message to the Users if Step 4 executes successfully.
In Step 6, we will call a function that we have explained in Step 1-5.
Once this script executes successfully, we can see list setting updated by navigating “Versioning Settings” of the list as shown below.
Code Snippet
- function EnableFolderCreation() {
- $list = $clientContext.Web.Lists.GetByTitle("Products");
- $list.EnableFolderCreation = $true;
- $list.Update();
- $clientContext.ExecuteQuery();
- Write - Host - ForegroundColor Green "Folder Creation Enabled"
- }
-
- function ListItemsDisableAttachments() {
- $list = $clientContext.Web.Lists.GetByTitle("Products");
- $list.EnableAttachments = $false;
- $list.Update();
- $clientContext.ExecuteQuery();
- Write - Host - ForegroundColor Green "List Items Attachments are disabled"
- }
-
- function EnableQuickLaunch() {
- $list = $clientContext.Web.Lists.GetByTitle("Products");
- $list.OnQuickLaunch = $true;
- $list.Update();
- $clientContext.ExecuteQuery();
- Write - Host - ForegroundColor Green "Quick Launch enabled for List Items"
- }
-
- function EnableVersioning() {
- $list = $clientContext.Web.Lists.GetByTitle("Products");
- $list.EnableVersioning = $true;
- $list.Update();
- $clientContext.ExecuteQuery();
- Write - Host - ForegroundColor Green "List Versioning Enabled successfully"
- }
-
- function EnableMinorVersions() {
- $docLib = $clientContext.Web.Lists.GetByTitle("ProductsDocuments");
- $docLib.EnableMinorVersions = $true;
- $docLib.Update();
- $clientContext.ExecuteQuery();
- Write - Host - ForegroundColor Green "Minor Versions Enabled on List successfully"
- }
-
- function ForceCheckOut() {
- $docLib = $clientContext.Web.Lists.GetByTitle("ProductsDocuments");
- $docLib.ForceCheckOut = $true;
- $docLib.Update();
- $clientContext.ExecuteQuery();
- Write - Host - ForegroundColor Green "Force Checkout Enabled"
- }
-
- function EnableContentApproval() {
- $docLib = $clientContext.Web.Lists.GetByTitle("ProductsDocuments");
- $docLib.EnableModeration = $true;
- $docLib.Update();
- $clientContext.ExecuteQuery();
- Write - Host - ForegroundColor Green "Content Approval Enabled"
- }
-
- function GrantPermissionOnMinorAndDrafts() {
- $docLib = $clientContext.Web.Lists.GetByTitle("ProductsDocuments");
- $docLib.DraftVersionVisibility = [Microsoft.SharePoint.Client.DraftVisibilityType]::Approver;
- $docLib.Update();
- $clientContext.ExecuteQuery();
- Write - Host - ForegroundColor Green "Permission Granted"
- }
That is all for this demo.
I hope you find it helpful.