Note that there are some explanatory texts on larger screens.

plurals
  1. POUnable to add a ribbon button to a custom list
    primarykey
    data
    text
    <p>Edit: Updated with input from Omlin</p> <p>I am attempting to add a custom button to the ribbon. I want the button associated with a custom list named “Products”. I am able to get the button to show for a built-in list, such as a Shared Documents, but not the custom products list. </p> <p>Below are examples of my code working with an existing list and not working with the custom list. I’ve also attached links to the working and non-working code that create the custom list and the ribbon button. These solutions assume that you have a site created at <a href="http://intranet.contoso.com" rel="noreferrer">http://intranet.contoso.com</a>. You will probably need to change Site URL of the project to get the code to run.</p> <hr> <h2>Working with and built-in list (Shared Documents):</h2> <p><strong>Elements XML:</strong></p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Elements xmlns="http://schemas.microsoft.com/sharepoint/"&gt; &lt;CustomAction Id="CustomRibbonTab" Location="CommandUI.Ribbon.ListView" RegistrationId="101" RegistrationType="List" Title="My Custom UI" Sequence="5" &gt; &lt;CommandUIExtension&gt; &lt;CommandUIDefinitions&gt; &lt;CommandUIDefinition Location="Ribbon.Documents.New.Controls._children"&gt; &lt;Button Id="Ribbon.Items.New.RibbonTest" Alt="Test Button" Sequence="5" Command="Test_Button" LabelText="Click me!" Image32by32="/_layouts/images/ribbon_blog_32.png" Image16by16="/_layouts/images/ribbon_blog_16.png" TemplateAlias="o1" /&gt; &lt;/CommandUIDefinition&gt; &lt;/CommandUIDefinitions&gt; &lt;CommandUIHandlers&gt; &lt;CommandUIHandler Command="Test_Button" CommandAction="javascript:alert('I am a test!');"&gt; &lt;/CommandUIHandler&gt; &lt;/CommandUIHandlers&gt; &lt;/CommandUIExtension&gt; &lt;/CustomAction&gt; &lt;/Elements&gt; </code></pre> <p><strong>Working Example</strong> <img src="https://i.stack.imgur.com/yuv77.png" alt="Working Example"></p> <p><strong>Full Visual Studio Solution</strong>: <a href="http://employees.claritycon.com/pwalke/blogs/working.zip" rel="noreferrer">http://employees.claritycon.com/pwalke/blogs/working.zip</a></p> <hr> <h2>Not Working</h2> <p><strong>Elements XML</strong>: I changed 2 lines from the above code.<br> Line 28: Associate the button with the custom products list, ID 10001, specified in the list template of the zipped code below. </p> <pre><code>RegistrationId="10001" </code></pre> <p>Line 85: Tell SharePoint to place the item within the Items menu.</p> <pre><code>&lt;CommandUIDefinition Location="Ribbon.ListItem.New.Controls._children"&gt; </code></pre> <p><strong>Screenshot</strong> – I would have expected the custom ribbon button to be added to the left of New Item. <img src="https://i.stack.imgur.com/pnKPl.png" alt="Not Working"></p> <p><strong>Full Visual Studio Solution</strong>: <a href="http://employees.claritycon.com/pwalke/blogs/notworking.zip" rel="noreferrer">http://employees.claritycon.com/pwalke/blogs/notworking.zip</a></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload