SharePoint 2010:将 Web 范围的功能限制为特定网站定义

发布于 2024-11-26 12:53:28 字数 240 浏览 0 评论 0原文

我为我的自定义博客网站定义创建了许多网络范围的功能。我的所有功能都工作正常,但是它们出现在我的网站集中所有网站的“网站功能”页面上,而不仅仅是博客。

显然它们只与博客相关(因为它们会做一些事情,比如在博客文章上启用匿名评论等)。

是否有任何方法可以限制某些 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清风挽心 2024-12-03 12:53:28

我认为不可能这样做。

如果您担心人们会从 UI 激活您的功能,您可以隐藏您的功能。

<Feature Hidden="TRUE"></Feature>

然后,在自定义博客站点模板的 ONET.xml 中,您可以在创建站点时强制激活您的功能。

<Configurations>
    <Configuration>
        <WebFeatures>
            <Feature ID="[Insert GUID of your feature]"/>
        </WebFeatures>
    </Configuration>
</Configurations>

这不会阻止通过 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.

<Feature Hidden="TRUE"></Feature>

Then in your custom BLOG Site Template's ONET.xml you can force your feature to be activated when the site is created.

<Configurations>
    <Configuration>
        <WebFeatures>
            <Feature ID="[Insert GUID of your feature]"/>
        </WebFeatures>
    </Configuration>
</Configurations>

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文