Home > SharePoint > Using PowerShell to Remove the "Use a Meeting Workspace" Option from SharePoint Calendars

Using PowerShell to Remove the "Use a Meeting Workspace" Option from SharePoint Calendars

I’ve just deployed a custom meeting site to a customer to handle multiple meetings within one site. Hence the option to “Use a Meeting Workspace” when creating a new or updating a calendar item is unnecessary, so they asked me to remove it to prevent anyone using it by mistake.

When creating a calendar item (or updating) this is the dialog you get, with the Use a Meeting Workspace highlighted.

meetingWorkspace

From SharePoint Blues I discovered that if you set the calendar list field to hidden then this option would no longer display. Taking this concept, I created a PowerShell script to set this to hidden on a one off basis.

The script is:

# Script to remove Use a Meeting Workspace from a specific calendar

function RemoveWorkspaceLink ([String]$siteUrl, [String]$calendarName)
{
[system.reflection.assembly]::LoadWithPartialName(“Microsoft.Sharepoint”) > $null
$site = New-Object Microsoft.SharePoint.SPSite($siteUrl)
if ($site -eq $null)
{
return
}

$web = $site.OpenWeb()
$list = $web.Lists[$calendarName]
if ($list -eq $null)
{
“Invalid list name ” + $calendarName
}
else
{
$field = $list.Fields[[Microsoft.SharePoint.SPBuiltInFieldId]::WorkspaceLink]
$field.Hidden = $true
$field.Update()
“Updated ” + $calendarName + ” on ” + $siteUrl
}

# Dispose of the SharePoint objects
if ($web) {$web.Dispose()}
if ($site) {$site.Dispose()}
}

RemoveWorkspaceLink “http://myserver/sites/site1″ “Calendar1″
RemoveWorkspaceLink “http://myserver/sites/site2″ “Calendar2″

I’ve written this as a function so that you can update multiple calendars at the time. If you saved this as a .ps1 file and then run it, the 2 calendars referenced at the bottom would be updated. Alternatively you could . source the file and use the function interactively, or just hard code the $siteUrl and $calendarName variables each time you run it.

The option is removed immediately you have run the script with no iisreset or application pool recycle required.

So with the script is run this is what you see with the Meeting Workspace option removed:

meetingWorkspaceAfter

This works well for hiding it on individual calendar lists, but doesn’t affect any other existing calendars or ones created afterwards.

I’ve since found a way to update all calendars in a site collection.

  1. ojsram
    June 6th, 2011 at 23:18 | #1

    Hi Richard,

    I had tried this option, but the WorkSpace option appears even after running the script.

    Note: The option of removing in a site collection which works fine.

    Can you pls. let me know if there are any steps to be done so that this option is removed only in a individual calendar.

  2. ojsram
    June 7th, 2011 at 16:47 | #2

    Change :

    $field.Hidden = $true

  3. June 7th, 2011 at 23:13 | #3

    Good spot. I was flicking it around while testing and posted the wrong version. Thanks for pointing it out and I’ve updated the post now.

  4. Hicham
    June 16th, 2011 at 12:05 | #4

    Thank you so much for this!!
    I think it’s weird that even if you make a new content type derived from the Event contenttype, you can hide fiels like “location”, but you can’t hide the “Use a meeting workspace” option.
    This certainly inspires me to dive into PowerShell more.

  5. kelsnz
    August 8th, 2011 at 02:50 | #5

    Perfect! Thank you!

  6. kelsnz
    August 8th, 2011 at 03:17 | #6

    Sorry,just one quick question – I want to the same as above but for the “Recurrence” and “All Day Event” field for one particular calendar. Are you able to advise of the Link names..?? (ie. Workspace is “WorkspaceLink”).

    Any help would be appreciated.

  7. September 16th, 2011 at 15:14 | #7

    Best thing to do is download SharePoint Manager from CodePlex. This will let you browse through in a treeview and find out any column name.

  1. December 10th, 2011 at 04:27 | #1