I've created a custom site content type that extends from Event. But I can't figure out how to hide the "All Day Event" and "Recurrence" columns for all lists using my custom content type.
5 Answers
No Code Solution (without Powershell and SharePoint Designer) to "hide Recurrence field" or "hide AllDayEvent field":
- go to list settings
- go to your event content type
- click on some field to edit
- the url will now look something like: https://xxx.sharepoint.com/sites/01/_layouts/15/ManageContentTypeField.aspx?ctype=0x0102005387B5A54CC55F43AF64A0B67EBB8CE2&List=a1b74248-bc1f-48ce-9bfd-02c7ab696931&Field=Category&Fid=%7B6df9bd52-550e-4a30-bc31-a4366832a87d%7D
- now remove the "Fid" Parameter and replace "Field" Parameter value with either "fRecurrence" or "fAllDayEvent"
- now you can edit the field and make it hidden so it won't appear in any form
You cannot do this with the UI, but you can do it with PowerShell or C# code. The internal names of the columns are fRecurrence
and fAllDayEvent
and the property you want to set is Hidden
. So you can update the associated FieldLinks of the Content Type with code like this (PowerShell):
$ctype = $myList.ContentTypes["Event"]
$ctype.FieldLinks["fRecurrence"].Hidden = $True
$ctype.FieldLinks["fAllDayEvent"].Hidden = $True
$ctype.Update()
The fields can be hidden at the content type level using SharePoint Designer.
- Create a custom content type based on the Event content type.
- Open SharePoint Designer.
- In the Navigation pane on the left, click Content Types.
- Select the content type created in step 1.
- In the ribbon, on the Content Type Settings tab, click Edit Columns.
- Locate the All Day Event field, and click Optional in its Property column. This activates the property drop down.
- Select Hidden in the dropdown.
- For the Recurrence field follow step 6 and step 7.
- Click Save.
- Go back to your browser and add the content type to a calendar list. The fields will be hidden.
I had to set Showindisplayform to false also
$web = Get-SPWeb "https://sitename"
$list = $web.Lists["List Name"]
$ctype = $list.ContentTypes["Content Type Name"]
$ctype.FieldLinks["fRecurrence"].Hidden = $true
$ctype.FieldLinks["fRecurrence"].ShowInDisplayForm = $false
$ctype.Update()
Here's how I did it in SharePoint Online: I created a new site content type, but I based it off the List > Item content type. I added the content type to the calendar, then I added from the existing site or list columns. I didn't include Recurrence. Sorted!