Wednesday, December 10, 2014

Enable workspace field in an existing SharePoint 2013 calendar

Meeting workspaces, site templates designed specially for meetings, are a discontinued feature in SharePoint 2013.
In SharePoint 2013 the meeting workspace templates are still available, but hidden.
But what if you want to use meeting workspaces on an existing calendar created from the SharePoint 2013 standard calendar template or a calendar that has been migrated from SharePoint 2010. It’s quite easy using the SharePoint Management Shell.


Replace URL and the name of your calendar.

$web = Get-SPWeb http://portal
$list = $web.Lists["Calendar"]
$myAss = [Reflection.Assembly]::LoadWithPartialName("Microsoft.SharePoint");
$type = $myAss.GetType("Microsoft.SharePoint.SPField");
[System.Reflection.BindingFlags]$flags = [System.Reflection.BindingFlags]::Instance -bor [System.Reflection.BindingFlags]::NonPublic
$SetFieldBoolValue = $type.GetMethod("SetFieldBoolValue",$flags)
$field = $list.Fields.GetFieldByInternalName("WorkspaceLink")
$arr = @()
$arr+="Sealed"
$arr+=$false
$SetFieldBoolValue.Invoke($field, $arr);
$arr = @()
$arr+="Hidden"
$arr+=$false
$SetFieldBoolValue.Invoke($field, $arr);
$method = $type.GetMethod("UpdateCore", $flags);
$method.Invoke($field, $true);
$field.ShowInEditForm = $true
$field.ShowInViewForms = $true
$field.Update()

No comments:

Post a Comment