Skip to content

Instantly share code, notes, and snippets.

Agenda - Sharepoint Online/ Office 365Important tips for bulk operation
1. Bulk Insert Into Sharepoint List
for(var i=11;i<=20;i++){util.Utils.ListItem.Add({listName:"BulkOperation",data:{Title:"Test"+i,Department:"IT_Computer"}}).then(r=>console.log(r))}
2. Bulk Update into Sharepoint List
body= {"itemIds":[11,12,13,14,15,16,17,18,19,20],"formValues":[{"FieldName":"Title","FieldValue":"Bulk_Update-Title"},{"FieldName":"Department","FieldValue":"HR"}]}
@anomepani
anomepani / UpdateItemWithoutIncreamentingVersioning.js
Created July 13, 2019 06:35
Update Sharepoint list Item Without Increamenting Versioning
//How to use
//UpdateItemWithoutIncreamentingVersioning(1,"Title Update without increamenting version control",true
function UpdateItemWithoutIncreamentingVersioning(itemid,title,RestrictVersion){
//payload for request
body= {"formValues":[{"FieldName":"Title",FieldValue:title}],bNewDocumentUpdate:RestrictVersion}
//Header data for sharepoint POST Request
var _payloadOptions = {
/*
Below code depends on two utility SPOHelper and BatchUtils
For SPOHelper -> https://anomepani.github.io/posts/spohelper-sharepoint-online-rest-api-crud-operation-utility-with-example/
For BatchUtils -> https://anomepani.github.io/posts/make-batch-request-with-rest-api-in-sharepoint-online-sharepoint/
You can skip SPOHelper if you want and instead of that you can right your own logic to get Request digest pass to below methods
*/
//Step 1: Initial Setup
/*
Code is used in YouTube video at : https://youtu.be/9TbjtS0mzlo
Below code depends on two utility SPOHelper and BatchUtils
For SPOHelper -> https://anomepani.github.io/posts/spohelper-sharepoint-online-rest-api-crud-operation-utility-with-example/
For BatchUtils -> https://anomepani.github.io/posts/make-batch-request-with-rest-api-in-sharepoint-online-sharepoint/
You can skip SPOHelper if you want and instead of that you can right your own logic to get Request digest pass to below methods
*/