Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
var featureCollection;
var oneFeature;
var site;
var guid
function findFeatureId() {
var clientContext = new SP.ClientContext();
site = clientContext.get_web();
clientContext.load(site);
featureCollection = site.get_features();
clientContext.load(featureCollection);
clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceeded), Function.createDelegate(this, this.onQueryFailed));
}
function onQuerySucceeded() {
var listEnumerator = featureCollection.getEnumerator();
var featureInfo = '';
while (listEnumerator.moveNext()) {
oneFeature = listEnumerator.get_current();
featureInfo += 'Feature ID: ' + oneFeature.get_definitionId() + '\n';
guid = oneFeature.get_definitionId();
}
alert(featureInfo);
}
function onQueryFailed(sender, args) {
alert('Request failed. ' + args.get_message() + '\n' + args.get_stackTrace());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment