Hiding the “Workspace” checkbox when creating a calendar event

If you would like to use the calendar list for creating events and don’t want to give your users the option to create a “Meeting Workspace”, hide the field.

There are a lot of possibilities to hide fields from the newform.aspx and dispform.aspx pages, for instance:

    1. Powershell script to show/hide columns when a user chooses to create, edit or view an item. It does not work for system fields.
    2. Javascript to search for a field on the page that machtes a searchquery.

    Powershell
    This you can use for hiding SharePoint fields you have created. Not for SharePoint system fields….

function Hide-SPField([string]$url, [string]$List, [string]$Field) {
  [System.Reflection.Assembly]::LoadWithPartialName(“Microsoft.SharePoint”)

  $SPSite = New-Object Microsoft.SharePoint.SPSite($url)
  $OpenWeb = $SPSite.OpenWeb()

  $OpenList = $OpenWeb.Lists[$List]

  $OpenField = $OpenList.Fields[$Field]
  $OpenField.ShowInNewForm = $True
  $OpenField.ShowInEditForm = $False
  $OpenField.ShowInDisplayForm = $False
  $OpenField.Update()

  $SPSite.Dispose()
  $OpenWeb.Dispose()
}

Hide-SPField -url http://YourURL/ -List “List Name” -Field “Field name”

Javascript
This you can use to hide any field on the page you want it to. Create a “script.txt” file in the list folder with SharePoint designer and copy paste the code below.

image

Then just put a content editor WebPart on for instance the “newform.aspx” and enter the link to your script file.

image

<script type=”text/javascript”>
var theRows = document.getElementsByTagName(“TR”);
var r = 0;
var strTitle = “”;
while (r < theRows.length)
{ try
{ strTitle = theRows[r].innerText || theRows[r].textContent;
strTitle = strTitle.replace(/\n|\r|\t|\^ /g,””);
if (strTitle.search(“Workspace”) == 0)
{ theRows[r].style.display = “none”; }
}
catch(err){}
r+=1;
}
</script>

image

2 thoughts on “Hiding the “Workspace” checkbox when creating a calendar event

  1. Pingback: Tweets that mention Hiding the “Workspace” checkbox when creating a calendar event « Rick Hilferink -- Topsy.com

Geef een reactie

Vul je gegevens in of klik op een icoon om in te loggen.

WordPress.com logo

Je reageert onder je WordPress.com account. Log uit / Bijwerken )

Twitter-afbeelding

Je reageert onder je Twitter account. Log uit / Bijwerken )

Facebook foto

Je reageert onder je Facebook account. Log uit / Bijwerken )

Google+ photo

Je reageert onder je Google+ account. Log uit / Bijwerken )

Verbinden met %s