SharePointCommunity
Die deutschsprachige Community für SharePoint, Microsoft 365, Teams, Yammer und mit Azure
Hide Fields in SharePoint Forms – the easy way

Blogs

Oliver Wirkus

Syndication

Certifications

Web 2.0

http://smits-net.de/img/linkedin_button.gif

XING

http://i80.photobucket.com/albums/j191/mikesamerica/twitter_button_zpsee74f711.png

 

 Add to Technorati Favorites

 

 Delicious Bookmark this on Delicious

 

  Locations of visitors to this page

 

Alright – I must admit that this is not a big thing. Most of you might already know this. But this blog is not only a public blog, but my personal memory hook. That’s why I posted this article :)

What’s this all about? Quite often there is the requirement to hide fields of a generic list or a library from some of the standard forms of SharePoint. Let’s make a little excursus first. When entering new data SharePoint uses the NewForm, when editing existing data SharePoint uses the EditForm and when viewing a single item SharePoint uses the DisplayForm. These are the main forms in SharePoint.

Sometimes you might want to hide a field in the EditForm or the NewForm to prevent users from changing the data of a field that is going to be filled by an Event Receiver.

There are several ways to accomplish this requirement. Most of you might think of the fabulous SharePoint Manager now, right? The SharePoint Manager would be my first choice tool too. But what if you aren’t allowed to run any third party software on the SharePoint Server?

Here is a little script that can be used to hide a given field from some (or all) of the SharePoint standard forms. Just change the URL of the web, the list’s name and the field’s name and run this script with SharePoint Management Shell. This script will hide a field from all standard forms. If you don’t want to hide a field from let’s say the Display Form, just remove the appropriate line!

Add-PSSnapin Microsoft.SharePoint.PowerShell –erroraction SilentlyContinue
$web = Get-SPWeb -Identity http://myserver
$list = $web.Lists["ListName"];
$field = $list.Fields["FieldName”];
$field.ShowInNewForm = 0;
$field.ShowInEditForm = 0;
$field.ShowInDisplayForm = 0;
$field.Update();
$web.Dispose();

More information on the members of a SharePoint field can be found here: http://msdn.microsoft.com/de-de/library/microsoft.sharepoint.spfield_members.aspx

As I said at the beginning – not that all-embracing blog post, but more a reminder for myself :)

 

TweetThisButton


Bereitgestellt 27 Nov 2013 10:14 von Oliver Wirkus
Gespeichert unter: , ,