Sharepoint Ribbon for view item form going full option
-
07-12-2019 - |
Question
I have a view item form which contains a custom WebPart for displaying that item. I have no issue with that but the ribbon for the display form looks weird: It contains lots of options that don't apply for the item.
Here is what I mean:
View tab:
Page tab:
I am doing no customization at all to the ribbon; it just appears like that.
What might trigger this?
Solution
Managed to remove the buttons from the WebPart. I've stuck this in the WebPart:
protected override void OnInit(EventArgs e)
{
Ribbon currentRibbon = SPRibbon.GetCurrent(this.Page);
foreach (string rid in litsOfRibbonIdsToExclude)
{
currentRibbon.TrimById(rid);
}
}
with litsOfRibbonIdsToExclude
an array with "Ribbon.ListForm.Display.Manage.ApproveReject", "Ribbon.ListForm.Display.Manage.CheckIn",
"Ribbon.ListForm.Display.Manage.CheckOut", ......
Licensed under: CC-BY-SA with attribution
Not affiliated with sharepoint.stackexchange