Last active
September 9, 2016 15:56
-
-
Save koltyakov/bbbade9d8fb1398a648c5c7bdc192cd8 to your computer and use it in GitHub Desktop.
PnP-JS-Core
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$pnp.sp.web | |
.lists.getByTitle('ListTitle').items | |
.get() | |
.then(function(items) { | |
// all items are in the `items` array | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var batchResults = []; | |
var batch = new $pnp.sp.createBatch(); | |
$pnp.sp.web.getList('/sites/dev01/lists/custom01').items.inBatch(batch).get().then(function(d) { | |
batchResults.push({ | |
custom01: d | |
}); | |
}); | |
$pnp.sp.web.getList('/sites/dev01/lists/custom02').items.inBatch(batch).get().then(function(d) { | |
batchResults.push({ | |
custom02: d | |
}); | |
}); | |
for (var i = 0, len = 10; i < len; i += 1) { | |
$pnp.sp.web.getList('/sites/dev01/lists/custom03').inBatch(batch).items.add({ | |
Title: 'Item ' + i | |
}); | |
} | |
batch.execute().then(function() { | |
console.log("All is done!", batchResults); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment