简体   繁体   中英

SharePoint 2010 - how to get list of stapled features for a site template / site definition?

I was attempting to debug an issue I was having with a feature stapler I created today (the issue is fixed and the error isn't important here), but it got me wondering. I want to be able to see a list of features that are stapled to a particular site template or definition, and what the scope is of the stapler, but I haven't found any way of doing that yet (most blogs and articles are on how to create a stapler).

So, in short, does anyone know of a way to retrieve a list of stapled features (via SP Object Model, PowerShell, Web UI, SharePoint Manager, SQL Script, or crystal ball)?

I have used PowerShell in the past. Using the sharepoint snap-in:

Get-SPFeature | Sort -Property Scope,DisplayName | FT -GroupBy Scope DisplayName,Id

will get everything on the farm or you can use:

Get-SPFeature -Site http://url

to get active site features on a site collection.

I've discovered that the best way to do this is to run a "findstr" console command on the features directory looking for stapler definitions in the elements.xml files. Once you have the list of features, you can just cross-reference them with the features that are activated on the site.

Hopefully this helps someone else...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM