自定义功能区按钮不显示在子网站上
我已成功将自定义功能区按钮添加到我的网站,并且一切都按预期显示。但是,当我转到子站点时,我的自定义功能区按钮不会显示。如何让我的按钮显示在主站点和子站点中?我认为部署到主站点的按钮也会转移到子站点,但我想事实并非如此。有人有任何想法或指导吗?我的按钮已添加到 RTE 的“插入”选项卡的“媒体”组中。
哦,我正在使用“站点”范围的功能来部署它。
这是我的按钮代码:
<?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>
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" group 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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我相信这是你的问题。您正在当前网站上获得激活,但由于它是在
Site
范围内部署的,因此需要为您想要使用的每个网站和子网站显式激活该功能它与。如果您希望它自动应用于特定 Web 应用程序中的所有站点/子站点,请使用
WebApplication
范围功能部署您的解决方案。要在部署后激活它,请转至“管理中心”>应用管理>管理 Web 应用程序,然后在 Web 应用程序功能区中选择“管理功能”。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.