Advanced Settings for list in SharePoint 2010 using PowerShell

In this article we will be seeing how to change the Advanced Settings for list in SharePoint 2010 using PowerShell and C#.

Go to List =>List Settings => General Settings =>Advanced Settings.


















Using C#:

  1. using (SPSite site = new SPSite("http://serverName:1111/"))

  2. {

  3. using (SPWeb web = site.RootWeb)

  4. {

  5. SPListlist=web.Lists["cl"];

  6. // Change the advanced settings

  7. // Update the changes

  8. list.Update();

  9. }

  10. }

Using PowerShell

  1. $site=Get-SPSite "http://serverName:1111/"

  2. $web=$site.RootWeb

  3. $list =$web.Lists["cl"]

  4. # Change the advanced settings

  5. $list.Update()

Item-level Permissions:








C#:

Read access

Read all items = 1 Read items that were created by the user = 2

  1. list.ReadSecurity = 2;

Create and Edit access

Create and edit all items = 1 Create items and edit items that were created by the user = 2 None = 4

  1. list.WriteSecurity = 4;

PowerShell:

  1. $list.ReadSecurity = 2

  2. $list.WriteSecurity = 4

Attachments:






C#:

  1. list.EnableAttachments = false;

PowerShell:

  1. $list.EnableAttachments = $false

Recent Posts

See All