In JSOM API SP.Feature
object exposes the following properties:
DefinitionId
– specifies the identifier for this featureDisplayName
The following example shows how to find a feature by DisplayName
property and print its identifier:
Example
var featureTitle = "TeamCollab"; //"Team Collaboration Lists";
var ctx = SP.ClientContext.get_current();
var features = ctx.get_web().get_features();
ctx.load(features,'Include(DisplayName,DefinitionId)');
ctx.executeQueryAsync(
function(){
var result = features.get_data().filter(function(f){
//console.log(f.get_displayName());
if(f.get_displayName() == featureTitle)
return f;
});
//print results
for(var i = 0; i < result.length; i++){
console.log(result(i).get_definitionId().toString());
}
},
function(sender,args){
console.log(args.get_message());
});