When we create a new calendar that is an event list on SharePoint online site, as default it will display fields like "All Day Event" and "Recurrence" as in the below screenshot. In some cases, you may not want these fields and here are different ways to hide them.
1. The most common way is to use SharePoint designer to create new form and then remove the fields in the advanced design. This has been described here in details.
The major challenge is the designer is not reliable toll and you might constantly get the following error "could not save the list changes to the server" like discussed here. I'm always getting this error and could not resolve it quickly. This is the way I would NOT recommend you to try!
2. The second way is to use Powershell to set the fields like described here. The key Powershell command is like below.
$field = $list.Fields["FieldName"]
$field.ShowInNewForm = $false
$field.Update()
However, I'm not able to find the equivalent PnP SharePoint online command. If you do, please let me know. This Powershell command seems only works for SharePoint on-premises.
3. The third way is to use the OoB UI with few tricks. Here is the details.
- Go to "List Settings" -> Advanced settings" -> Set “Allow management of content types?” to “Yes”.
- Click the content type used in the event list and click one field with link like “Category”. You will be able to make the field “Hidden”.
- Two fields like “All Day Event” and “Recurrence” do not have direct link you could modify. You should copy the URL from previous "Category" field like this.
- You could now remove the "Fid" Parameter and replace "Field" Parameter value with either "fRecurrence" or "fAllDayEvent".
Please note if you hide the “All Day Event” on the content type as in method #3, the calendar cannot be displayed in the event webparts! The events will be empty.
4. The forth way is to use the javascript if this is allowed on the SPO site. Here is the details.
Add a content editor webpart on respective pages (NewForm.aspx/ DispForm.aspx/ EditForm.aspx) and use below jQuery code to hide SharePoint field.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('nobr:contains("Category")').closest('tr').hide(); //here we are hiding field named "Category"
$('nobr:contains("All Day Event")').closest('tr').hide(); //here we are hiding field named "All Day Event"
$('nobr:contains("Recurrence")').closest('tr').hide(); //here we are hiding field named "Recurrence"
});
</script>
This method will hide the fields and still allow the event webpart to display the calendar events. However, this is only applicable when script is allowed on the site. If not, you could enabled it.Now you should be able to hide “All Day Event” and “Recurrence” along with other fields you want to hide from end users.
There should be other ways like Rest/Graph API to hide, or may be SPFx customization you can try.
Its been long from the release of the migration tool V5.2.0. But, still, now the tool is not at all comparable to other tools in the market. it`s better to select tool wisely to do hassle-free migrations which boost our productivity too... give a try SharePoint Migration Tool and Microsoft Teams Migration Tool
ReplyDeleteNew SharePoint Features : Here's how Saketa is transforming from a dedicated SharePoint Migration tool to an overall SharePoint solution.
New SharePoint Features