7

How do I hide the "Datasheet view" option (under "View Format") in a list's ribbon menu?

8
+50

As described in this article : Remove button from the Ribbon in SharePoint 2010, you can, with a feature, remove existing button.

In your case, the feature.xml file should be :

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
    Id="RemoveDataSheetButton"
    Location="CommandUI.Ribbon"
    RegistrationType="List"
    RegistrationId="101">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition
          Location="Ribbon.List.ViewFormat.Datasheet" />
      </CommandUIDefinitions>
    </CommandUIExtension>
  </CustomAction>
</Elements>
  • Aha! Changing the 'Library' in the Location to 'List' allows it to work for lists (with the appropriate RegistrationId). Thanks for your help. I'll award the bounty once the 24 hours have passed. – Stu Pegg Jul 19 '11 at 13:25
  • edited :) thx for your hawk eyes – Steve B Jul 19 '11 at 13:45
  • 2
    Word of warning to others using this: it seems to only be compatible with 2010. – Stu Pegg Jul 22 '11 at 10:19
4

In addition to Steve B's solution, another 2010-only way of doing this is to set the following property to true:

SPList.DisableGridEditing

Unfortunately there appears to be no way to do this in 2007.

3

You could use javascript to do this.

var menuItems = document.getElementsByTagName('ie:menuitem');
for (i=0; i<menuItems.length; i++)
  if (menuItems[i].text == 'Edit in Datasheet')
    menuItems[i].removeNode();

jQuery version:

$("ie\\:menuitem[text='Edit in Datasheet']").each(function() {
    this.hidden = true;
});
1

Q: Have you tried simply unchecking the "Allow items in this document library to be edited using the datasheet?" to NO

  • I believe that's the front-end counterpart to SPList.DisableGridEditing, and hence also 2010-specific. – Stu Pegg Oct 4 '12 at 14:47
1

Just got to List 'Advance settings' and there is an option that allows you to disable Datasheet view. Just say 'NO' to disable datasheet view.

0

Go to List settings for the page you want to edit - under general settings find Advanced settings - There should be a datasheet edit (yes 0r No)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.