Domanda

Hi I'm basically trying to do this.

Sharepoint 2013: How to customize context menu view in document library

However even after I follow the instructions it doesn't work. My code is

SPSecurity.RunWithElevatedPrivileges(delegate ()
                {
                    SPField field = list.Fields.GetFieldByInternalName("LinkFilename");
                    field.CalloutMenu = false;
                    field.CalloutMenuAllowed = SPField.ListItemMenuState.Prohibited;
                    field.ListItemMenu = true;
                    field.ListItemMenuAllowed = SPField.ListItemMenuState.Allowed;
                    field.Update();
                    list.Update();

                });

Looking at the sharepoint 2013 manager. It does have

CalloutMenu:false

CalloutMenuAllowed: Prohibited

LinkToItem: false

LinkeToItemAllowed: Prohibited

ListItemMenu: true

ListItemMenu: Required

Which seems right, but doesn't have the right effect. Is there something I'm doing wrong here?

Could it be something within SharePoint preventing this and maybe adding a custom field that it has no knowledge of would open the correct menu?

The question above says the equivalent in powershell - what is that?

È stato utile?

Soluzione

It seems my question was answered elsewhere, basically just change the style to basic table. Skipping Callout menu within context menu (ECB-Menu) in a list view of document library - SP2013

Then it goes back to a more standard SharePoint 2010 kinda feel.

To fully answer the question then use this snippet to set the style on feature activation.

 var s = web.ViewStyles.StyleByID(0);

                view.ApplyStyle(s);
                view.Update();

So that sets it to Basic Table.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a sharepoint.stackexchange
scroll top