Wednesday, August 10, 2011

Getting SharePoint Feature IDs (the easy way)…

 

So I needed to grab the id of a feature so that I could programmatically activate it during a site / web provision process.  Google gives me a couple of lists with the standard features and ids.  It also tells me I can do a file contents search against the features directory once I’ve obtained the resource key from the global resources file (eek).

I wondered that, if in like rendering an OOB new/edit/display form, the SharePoint Developers at MS put the info I needed hidden in HTML?

Sure enough – the corresponding feature id is there as the ‘id’ of the div surrounding the button (input) element:

image

(Obviously, this only works for features that aren't hidden)

1 comment:

  1. So simple. For Sharepoint 2010 I would just use Powershell (Get-SPFeature). But your approach is very useful for the old WSS world, where Powershell had not dared to tread. Thanks.

    ReplyDelete