Skip to content

Instantly share code, notes, and snippets.

@beckettkev
Created March 15, 2017 17:43
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 beckettkev/8325e2f7044c3f6a0ba39a3c4d623c1d to your computer and use it in GitHub Desktop.
Save beckettkev/8325e2f7044c3f6a0ba39a3c4d623c1d to your computer and use it in GitHub Desktop.
Get an individuals Alerts - SPO
var ctx = SP.ClientContext.get_current();
this.user = ctx.get_web().get_currentUser();
this.alerts = this.user.get_alerts();
ctx.load(this.user);
ctx.load(this.alerts);
ctx.executeQueryAsync(()=> {
var enumerator = this.alerts.getEnumerator();
while(enumerator.moveNext()) {
var l = enumerator.get_current();
console.log(l.get_title());
/*
If you now load the list, you can get this information to...
this.list = l.get_list();
ctx.load(this.list);
ctx.executeQueryAsync(() => {
console.log(' ' + l.get_list());
}, (e, t)=> { });
*/
console.log(' Delivery Channels: ' + l.get_deliveryChannels());
console.log(' Event Type: ' + l.get_eventType());
console.log(' Always Notify: ' + l.get_alwaysNotify());
}
}, ()=> {
console.log('WORSE THAN EGGS!');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment