SharePoint 2010:将 Web 范围的功能限制为特定网站定义
我为我的自定义博客网站定义创建了许多网络范围的功能。我的所有功能都工作正常,但是它们出现在我的网站集中所有网站的“网站功能”页面上,而不仅仅是博客。
显然它们只与博客相关(因为它们会做一些事情,比如在博客文章上启用匿名评论等)。
是否有任何方法可以限制某些 Web 范围的功能对特定类型的网站(即从特定网站定义创建的网站)的可见性?
I have created a number of web-scoped features for my customised Blog site definition. All my features work fine, however they appear on the "Site Features" page of all sites in my site collections -- not just the blogs.
Obviously they are only relevant to blogs (as they do things like enabling anonymous comments on blog posts etc).
Is there any way to limit the visibility of certain web-scoped features to sites of a specific type (i.e. those created from a particular site definition)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为不可能这样做。
如果您担心人们会从 UI 激活您的功能,您可以隐藏您的功能。
然后,在自定义博客站点模板的 ONET.xml 中,您可以在创建站点时强制激活您的功能。
这不会阻止通过 STSADM 或 PowerShell 激活该功能。如果您想走那么远,也许您可以向您的功能添加一个功能接收器,以防止它在非博客站点上激活......但这真的有必要吗?
I don't think its possible to do that.
If you are worried people will activate your feature from the UI you could make your feature hidden.
Then in your custom BLOG Site Template's ONET.xml you can force your feature to be activated when the site is created.
This wouldn't stop the feature from being activated via STSADM or PowerShell. If you wanted to go that far maybe you could add a feature receiver to your feature to prevent it from being activated on non-BLOG sites... but is it really necessary?