Skip to content

Instantly share code, notes, and snippets.

@ryanjonhealy
Last active April 5, 2016 07:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryanjonhealy/7c3a16008eec07ef70e2777847b0d528 to your computer and use it in GitHub Desktop.
Save ryanjonhealy/7c3a16008eec07ef70e2777847b0d528 to your computer and use it in GitHub Desktop.
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