Removing “Add new item” link by setting Toolbar=”None” affects ribbon customisations

I recently noticed that some ribbon customisations I made to a custom SharePoint solution were not displaying. The ribbon had been customised so that certain items were removed from the list pages. So for example, the user could not add a new item directly to the list from the All Items view page – it had been deemed that items should only be added via an alternative mechanism. This was achieved via declarative customisation (the ‘New’ group was removed) and had been working. Until this point. After much scratching of head, stroking of beard etc and poking around I worked out why.

The customer had asked for the ‘Add new item’ link on the List View Web Part to be removed, which had been achieved by setting the ‘Toolbar Type’ property to ‘None’. Great – this removed the ‘Add new item’ link but amazingly this interfered with the script running on the page and prevented the ribbon customisations from working, So the ‘New’ group had reappeared. I confirmed this by setting the ‘Toolbar Type’ back to ‘Full’. Et voila! The customisations were working again.

As an aside I had managed to set the Toolbar Type to none in the schema of a custom list definition by setting the Type attribute of the Toolbar element to “None” in the view definition.

<View BaseViewID="1" Type="HTML" WebPartZoneID="Main" DisplayName="$Resources:core,objectiv_schema_mwsidcamlidC24;" DefaultView="TRUE" MobileView="TRUE" MobileDefaultView="TRUE" SetupPath="pages\viewpage.aspx" ImageUrl="/_layouts/images/generic.png" Url="AllItems.aspx">
   <Toolbar Type="Standard" />

Hope this saves someone out there a few hours!

This entry was posted in SharePoint, SharePoint 2010 and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>