Skip to content
December 5, 2011 / red1s

Quick Tip – Remove the Calendar workspace item from SharePoint Calendar entry


Ben from Moblog came up with a great script on how to remove the create a calendar workspace from the calendar content type – which can be viewed here –

For my own reference and to make it a bit more visual I’ve constructed an additional post on it and added some screenshots to detail the exercise

His blog with some of the excerpts I’ve used can be seen here:

http://moblog.bradleyit.com/2008/10/disabling-workspaces-from-sharepoint.html

One of the more popular posts on this blog has been my description on how to remove the “Workspace” option from SharePoint forms. For those that aren’t familiar with this particular annoyance, think of it as SharePoint’s appendix – not really useful, but can cause problems if it gets infected … (that sounded better in my head).

Anyway, I’ve come up with a cleaner (cleverer!) way to accomplish this task! You’ll still need to “pop the hood” on all of the forms that you want to remove the “Workspace” option from by using the “…Form.aspx?ToolPaneView=2” trick

Alternatively you can access the page fields that you want to specifically edit using the Form Web parts item –

clip_image001

and add a Content Editor Web Part (CEWP) to the bottom of the page,

Note – Its important to add it to the end of the page, as it wont work if added to the beginning as Jscript wouldn’t have rendered the field yet

clip_image002

but now you only have a very small bit of JavaScript to add to the CEWP.

clip_image003

And here it is:

<script type="text/javascript">

var trs = document.getElementsByTagName("TR");

for (var r in trs) {

var row = (trs[r].innerText || trs[r].textContent)+"";

if (row.match(/^Workspace/)) { trs[r].style.display = "none"; }

}

</script>

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

If you want to get experimental with this and try to remove other rows from your forms, you can do so by modifying the IF statement as follows:

if (row.match(/^Workspace/) || row.match(/^Row Title 1/) || row.match(/^Row Title 2/))

{ trs[r].style.display = "none"; }

}

</script>

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

NOTE: It’s VERY important to include the carat (^). If you don’t you’ll kill your page. If this happens to you, simply hit the “Back” button & add the ^.

Advertisements

One Comment

Leave a Comment
  1. Nik / Aug 22 2012 10:02 pm

    This worked great. Thank you!

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

%d bloggers like this: