I was wondering that there should be some decent way to hide any field available on 'New' or 'Edit' page.
I googled around, and I found couple of responses, forexample,
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 dis-advantages 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 didnt work for me though), but it is worth adding it here, just in case, if people are trying to solve the problemin this manner.
<script language='javascript' type='text/javascript' >
var toolbar = document.getElementByName("<name attribute value>
<script>
This can be added in asp:content ContentPlaceHolderId="PlaceHolderTitleAreaClass".
Once again as I said that it didnt 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
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="http://schemas.microsoft.com/sharepoint/v3" StaticName="WorkspaceLink" ShowInEditForm="FALSE" ShowInNewForm="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.
Dont forget to do IISRESET
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.
Update as on 01/13/2009:
1. The approach described here is applicable for a website. For example, if there are different calendars for different locations or divisions for an organization, then this approach can be used to hide a field in all calendars in that website. However, if the requirement is to show/hide 'Workspace' field for a specific list, there is a tool available in http://www.codeplex.com/spm [Thanks for Boris].
9 comments:
Thanks for sharing this. It's nice to know that the scope of the feature change is "Web" and other webs won't be affected.
Neatly explained. Thanks for your post.
I worked out your findings and observed that, inspite of specifiying the url of the particular site in the batch file, the particular column in SharePoint calender is not available for all the sites. Can you explain me on this...
Hello JG,
URL can be one site or site collection. If it is one site, then the changes will be on the specific website only. HOwever, if the URL is a site collection, then the changes will be on the site as well as all sub-sites too.
Hope I answered your question, please send me email at pyaarey@gmail.com for more questions. Thanks!!
Cool method. What I did was to use the SharePoint Manager (http://www.codeplex.com/spm):
1. navigated to my site
2. Found the list
3. Expanded the "Fields" node under the list
4. find the "Workspace" icon and set its property hidden to true.
That way I only modified this for that list. True it's not removing the field, but it kept the original feature intact.
Hooray! This appeared to be the best solution presented while searching and it worked like a charm! Thank you for saving me sooo many headaches and long hours!!!!
Nice way to do this:
http://www.directsharepoint.com/2011/05/hiding-workspace-checkbox-while.html
Prabhat,
Thank you for posting the link.
Yes, there are multiple ways of achieving the same result. It just require programming effort.
Post a Comment