开发者

Custom Ribbon Button doesn't show on subsites

开发者 https://www.devze.com 2023-03-07 16:32 出处:网络
I\'ve successfully added a custom ribbon button to my site and everything shows up as expected. However, when I go to a sub site, my custom ribbon button doesn\'t show up. How can I get my button to s

I've successfully added a custom ribbon button to my site and everything shows up as expected. However, when I go to a sub site, my custom ribbon button doesn't show up. How can I get my button to show up in the main site and also sub sites? I assumed that a button deployed to the main site would also carry over to sub sites but I guess that isn't the case. Anyone have any ideas or guidance? My button get's added to the "Media" gro开发者_开发百科up of the "Insert" tab for the RTE.

Oh, and I am deploying this with a "Site" scoped feature.

Here is my button code:

<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <CustomAction
        Id="CommandUI.Ribbon.EditingTools.MyCompany_InsertVideoButton"
        Location="CommandUI.Ribbon">
        <CommandUIExtension>
            <CommandUIDefinitions>
                <CommandUIDefinition
                    Location="Ribbon.EditingTools.CPInsert.Media.Controls._children">
                    <Button
                        Id="Ribbon.EditingTools.CPInsert.Media.Controls.MyCompany_InsertVideoButton"
                        ToolTipTitle="Video"
                        ToolTipDescription="Insert a video into the page."
                        Sequence="50"
                        LabelText="Insert Video"
                        Image16by16="/_layouts/MyCompany/images/icons/ribbonInsertVideoButton_16.png"
                        Image32by32="/_layouts/MyCompany/images/icons/ribbonInsertVideoButton_32.png"
                        Command="MyCompany_InsertVideoButtonCommand"
                        TemplateAlias="o1" />
                </CommandUIDefinition>
            </CommandUIDefinitions>
            <CommandUIHandlers>
                <CommandUIHandler
                        Command="MyCompany_InsertVideoButtonCommand"
                        CommandAction="javascript:alert('MyCompanyInsertVideoButton clicked!');"
                />
            </CommandUIHandlers>
        </CommandUIExtension>
    </CustomAction>
</Elements>


Oh, and I am deploying this with a "Site" scoped feature.

I believe this is your problem. You are getting the activation on the current site, but because it is deployed with Site scope, the feature will need to be explicitly activated for every site and subsite you want to use it with.

If you want it to automatically apply to all sites/subsites within a particular web application, deploy your solution with a WebApplication scoped feature. To activate it once deployed, go to Central Administration > Application Management > Manage Web Applications, then choose "Manage Features" in the Web Applications ribbon.


Just a thought. There might be an issue, if you are deploying the ribbon button feature as a farm solution. Can you try the same as a sandbox solution deployment? That might work.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号