SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have created an elements.xml file to make a ribbon control for my test site but the control is not getting displayed on the ribbon. I am trying to look on a document library "shared documents" and below is my code.

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="">

                <CommandUIDefinition Location="Ribbon.Documents.New.Controls._children">
                        LabelText="Click Me To Test"


                <CommandUIHandler Command="JSAlert"
                                  CommandAction="javascript:alert('hello world!');">


share|improve this question
up vote 1 down vote accepted

I found out that I was working on a sandboxed solution and it was not deploying my code to the site. Dont know! why ? but when I created a new project with farm solution and pasted the same code, it worked!

share|improve this answer

You couldd try changing your CustomAction[Location] into Location="CommandUI.Ribbon". Example:

<CustomAction Id="YourRibbonButton" Location="CommandUI.Ribbon" Title="Your Button">

And perhaps try a lower Sequence, and also try removing the Registration* just to test.

share|improve this answer
Still not working, below is the changed code as per your suggestion. <CustomAction Id="CustomRibbonControlTest1" Location="CommandUI.Ribbon" Title="CustomRibbonControlTest1Title" > – RHM Nov 15 '12 at 14:05

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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