Friday, December 6, 2013

#SharePoint | Change Settings of Calculated Column

Problem:
It seems that, starting SharePoint 2010, some Site Column types do not allow changing the Column Settings to "Required", "Optional" or "Hidden", through the UI (browser), as they are greyed out.
One of these types is the Calculated column.



Solution:
This seems to be by design, a feature they say, probably a bug the way I see it.
Anyway, the same thing can be done through SharePoint Designer or PowerShell.

SPD:

If we open the List, go to the Content Type and go to Edit content type columns we will get to the view below. Although the calculated columns are grayed out as well, we can click the property until the dropdown menu appears, select the new property, and save the changes.

1/ Open SharePoint Designer 2010.
2/ Open the website that contains your list with the calculated column.
3/ Click on "Lists and Libraries" in the left column (under Site Objects).
4/ On the right, click on the list that contains your calculated column.
5/ Under "Content Types", click on the content type where you want to hide the calculated column
6/ In the content type screen, click "Edit content type columns" under "Customization
7/ In the column "Property", try clicking a few times on the "Optional" value until it changes into a dropdown list.
8/ Select "Hidden" from the dropdown list.
9/ Save your changes.



PowerShell:

A simple PowerShell script can also work by setting the visibility for each form type.

$web=get-spweb
$list=$web.Lists[“ ”]
$field=$list.Fields[“ ”]
$field.ShowInViewForms=$false
$field.ShowInDisplayForm=$false
$field.ShowInEditForm=$false
$field.ShowInNewForm=$false
$field.Update($true)
$web.Dispose()



Sources:
http://social.technet.microsoft.com/Forums/en-US/b678cc72-b7a1-42c5-a488-1e15736c39df/calculated-columns-value-cant-be-set-hidden-in-2010-but-it-can-be-done-in-2007

http://social.msdn.microsoft.com/Forums/sharepoint/en-US/4c07a7fc-d80b-4b3a-b3df-bd3e869ac606/set-a-calculated-column-as-hidden-in-a-content-type?forum=sharepointgeneralprevious

http://social.msdn.microsoft.com/Forums/sharepoint/en-US/7a3c7846-3b4f-4c76-9686-f89f1e16a4cf/hide-a-column-of-a-sharepoint-list?forum=sharepointcustomizationlegacy

No comments:

Post a Comment