Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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="http://schemas.microsoft.com/sharepoint/">
    <CustomAction
        Id="CustomRibbonControlTest1"
        Location="Ribbon.Documents.New.Controls._children"
        RegistrationId="101"
        RegistrationType="List"
        Title="CustomRibbonControlTest1Title"
        Sequence="60"
        >

        <CommandUIExtension>
            <CommandUIDefinitions>
                <CommandUIDefinition Location="Ribbon.Documents.New.Controls._children">
                    <Button
                        Id="Ribbon.Documents.New.Controls.CustomCommandButton1_CustomRibbonControlTest1"
                        Command="JSAlert"
                        CommandType="General"
                        LabelText="Click Me To Test"
                        Sequence="60"
                        />

                </CommandUIDefinition>

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

                </CommandUIHandler>
            </CommandUIHandlers>
        </CommandUIExtension>

    </CustomAction>
</Elements>
share|improve this question
add comment

2 Answers

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
add comment

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
add comment

Your Answer

 
discard

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.