Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

SharePoint Rest Api in Batch using PnP JS

import { sp } from "@pnp/sp/presets/all";
import { dateAdd } from "@pnp/common";

const batch = sp.web.createBatch();

var ListsArr = ["Admin_Test", "Test_attch","TestCopy"]
ListsArr.forEach((list)=>{
  sp.web.getList(`sites/MyTeamSite/Lists/${list}`).items.inBatch(batch).usingCaching({
    expiration: dateAdd(new Date(), "minute", 2),
    key: `cache_${list}`,
    storeName: "local"
  }).get()
.then(items1 => {
    console.log(items1);
});
})


// this line executes actual HTTP request to $batch endpoint
batch.execute()
.then(data => {
    // at this point all requests will be completed
    console.log('done');
});
Comment

PREVIOUS NEXT
Code Example
:: Find specific string by using includes in javascript 
Javascript :: unique id generator javascript 
::  
::  
:: React Redux component getById crud exemple 
Javascript :: Serve JSON on a Specific Route 
Javascript ::  
Javascript :: checkout code 
Javascript :: syntax error unexpected number in js 
Javascript :: get image height Jimp nodejs 
:: javascript list all declared variables 
Javascript :: how can i use two api at the same time in angular 
:: tab pane full calendar not showing 
Javascript :: add grepper code 
Javascript :: filewatcher nodejs 
:: flow parsing package.json and showing error 
Javascript :: how to get html paramater in js 
Javascript :: how to find prime factors of a number in javascript 
Javascript ::  
Javascript :: Nodemailer Reuseable Code 
Javascript :: nodejs Websocket chat room 
Javascript :: html how to remove class with js 
Javascript ::  
Javascript ::  
Javascript :: Private slots are new and can be created via Static initialisation blocks in classes 
Javascript :: javascript condition based on table cell value 
:: how can click div close and open next day jquery 
Javascript :: add and remove multiple markers on google maps js 
Javascript :: Example of Numeric Separators in es12 
Javascript :: ngFor fake 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =