开发者

SharePoint 2010: Limiting web-scoped features to specific site definitions

I have created a number of web-scoped features for my cust开发者_Python百科omised 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)?


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?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜