Posts Tagged ‘SharePoint Show or Hide Fields’

MOSS 2007 – Show/Hide ‘Workspace’ on New/Edit Form

December 4th, 2009 Atul Shukla No comments

Somebody asked me about hiding a field called 'Workspace' from Calendar: New Event or Edit existing event.
I was wondering that there should be some easy way to hide any field available on 'New' or 'Edit' page.

I googled around, and I found couple of responses, for example:

  1. Modifying the NewForm.aspx page in SharePoint Designer 2007, hiding existing List Form Web Part, and then adding Custom List Form. Then delete the Workspace row from the form.

    Let me talk about the disadvantages of this option:

    • a. Attach File will NOT work. You need to investigate further to make it work. Still painful process.
    • b. Try to create a 'Recurring' event; it will not work as expected.

    Considering these advantages, I thought that this is very tedious process, and one has to make the changes to all calendar lists. And then this change is required to be done on NewForm.aspx and EditForm.aspx. How about that? So it is really very painful process.

  2. Another option is again, modifying the NewForm.aspx or EditForm.aspx, and add following script (However, it didn’t work for me though), but it is worth adding it here, just in case, if people are trying to solve the problem in this manner.

    <script language='JavaScript' type='text/javascript'>
        var toolbar = document.getElementByName("<name attribute value>"); = 'none'; = 'none';

    This can be added in asp:content ContentPlaceHolderId="PlaceHolderTitleAreaClass".
    Once again as I said that it didn’t work for me, but it can be done this way too.

  3. Recommended way. First thing is that it is a feature, and can be found (12 Hive folder) at C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\Template\Features\EventsList. Yes, it is event list feature. Now the modifications are required in schema.xml that can be found under Events folder (folder location, once again, is ..\12\TEMPLATE\FEATURES\EventsList\Events). This file can be modified in notepad.exe.

    While looking into the Calendar List Settings in Internet Explorer, I noticed that this field 'Workspace' is of type 'Cross Project Link'. This is important to remember, and search 'CrossProjectLink' in schema.xml file. I noticed there is only one instance of it.

    Secondly, the field is SharePoint field so looked for the corresponding class which is SPField. I looked into SPField Class Members on MSDN and found a couple of interesting properties (and used two of them), for example, ShowInDisplayForm, ShowInEditForm, ShowInListSettings, ShowInNewForm, ShowInVersionHistory, ShowInViewForms. I was interested in ShowInEditForm and ShowInNewForm properties only. So in schema.xml file, for Field of Type="CrossProjectLink", added these two properties as attributes, and set the value="FALSE".

    IMPORTANT: attribute value should be set as ShowInNewForm="FALSE" (case sensitive). If you set the value as ShowInNewForm="false", it will not work, so be careful here.

    My final <Field> is looked like:

    <Field ID="{08fc65f9-48eb-4e99-bd61-5946c439e691}" Type="CrossProjectLink" 
        Name="WorkspaceLink" Format="EventList" 
        DisplayName="$Resources:core,Workspace;" DisplayImage="mtgicon.gif" 
        HeaderImage="mtgicnhd.gif" ClassInfo="Icon" 
        Title="$Resources:core,Meeting_Workspace;" Filterable="TRUE" 
        Sealed="TRUE" SourceID="" 
        StaticName="WorkspaceLink" ShowInEditForm="FALSE"

    As mentioned, I added only two attributes. Save the schema.xml file.

Now the task is to publish the feature with changes. And since the feature is already installed and activated, so it is mandatory to de-activate it and then un-install it.

To smoothen the process I wrote two batch files one each for de-activate, un-install and install, activate:

script for uninstallfeature.bat

path="C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN"
cd \
cd "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN"
stsadm.exe -o deactivatefeature -filename EventsList\Feature.xml -url http://moss2007:8551/sites/Demo1
stsadm.exe -o uninstallfeature -filename EventsList\Feature.xml -force
cd \

It is straight forward to understand, however, if you want instructions for the same, can send me request.

script for installfeature.bat

path="C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN"
cd \
cd "C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN"
stsadm.exe -o installfeature -filename EventsList\Feature.xml
stsadm.exe -o activatefeature -filename EventsList\Feature.xml -url http://moss2007:8551/sites/demo1
cd \

URL is required to install the feature, in this script, I am deploying the feature for a specific website.
Don’t forget to do ISRESET

I am done, and when I tried to create or edit a calendar event, I don't see 'Workspace' option in there. I double checked that attach file is working, and I am able to create a 'Recurring' event too.
It is really very useful tip for me, so thought let me add it here for future reference too.

This post is written by Atul Shukla. Atul is a Manager in the Microsoft SharePoint Practice at Ignify. Ignify has over 300 person years of SharePoint experience with multiple SharePoint implementations. Ignify also internally leverages Microsoft SharePoint as a tool to collaborate across all its offices and for all its projects. For help on SharePoint Services email us at