Disable column content edition

SP2013


Hello everyone,

Today I will talk about a sometimes requested feature : prevent change a field in a SharePoint list in edit mode.

If prevent the display of a field in the edit mode of a list can be easily done via PowerShell, do not forget that users can go through the “Quick Edit” mode of the list and bypass this configuration.

To completely prohibit the modification of a field after the creation of the item, you have to go through these two steps: Do not display the field in edit mode field and disable the DataGrid view.

If the second part can be done via the “List settings” menu of the list, the first requires a little development (PowerShell script or Visual Studio Development).

PowerShell is faster to set up, so here is the script to perform those two actions:

Add-PSSnapin Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue

$siteUrl=”Site url”

$ListUrl=”List relative url”

$columnName =”Column Name”

$web = Get-SPWeb -Identity “$siteUrl”

$list = $web.GetList($web.Url + $ListUrl)

$list.Fields[$columnName].ShowInEditForm=$false

$list.Fields[$columnName].Update()

$list.DisableGridEditing=$true

$list.Update()

$web.Dispose()

 

Hope this helps

Christopher

Advertisements
This entry was posted in SharePoint 2010, SharePoint 2013 and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s