Last active
November 19, 2018 09:24
-
-
Save ashelopukho/47efec9d05135a7a969e11b397059ff5 to your computer and use it in GitHub Desktop.
Update multiple items: pnp js
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
(async () => { | |
const batch = pnp.sp.web.createBatch(); | |
const list = pnp.sp.web.lists.getByTitle('ListA'); | |
const items = await list.items.select('Id,Title').get(); | |
const entityTypeFullName = await list.getListItemEntityTypeFullName(); | |
for (const item of items) { | |
list.items.getById(item.Id).inBatch(batch) | |
.update({ Title: `${item.Title} (${item.Id})` }, '*', entityTypeFullName); | |
} | |
await batch.execute(); | |
console.log('Done'); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment