Please specify what version of the library you are using: [2.0.11]
Please specify what version(s) of SharePoint you are targeting: [SharePoint Online, SPFx 1.11.0]
Using the calendarView object on a calendar should respect inBatch in the same manner as other endpoints, and fire multiple requests together under the POST batch endpoint.
The request ignores the batch and each batch entry uses the direct endpoint. Depending on the position of the inBatch, the batch appears to sometimes 'hang' indefinitely.
const userIds = ["...", "...", ...];
const startTime = new Date();
const endTime = new Date((new Date()).getTime() + 24*60*60*1000); // a day from now, or whatever...
const batch = graph.createBatch();
// then either
userIds.forEach(id =>
graph.users.getById(id)
.calendar.calendarView(startTime.toISOString(), endTime.toISOString())
.inBatch(batch) // batch promise resolves
().then(console.log)
batch.execute();
// or
userIds.forEach(id =>
graph.users.getById(id)
.calendar
.inBatch(batch) // batch promise never resolves
.calendarView(startTime.toISOString(), endTime.toISOString())
().then(console.log)
batch.execute();
Yep, this is a bug. Fixed and will be part of the next release. Thanks for letting us know!
Most helpful comment
Yep, this is a bug. Fixed and will be part of the next release. Thanks for letting us know!