Pnpjs: [Graph] `calendarView` appears to ignore `inBatch`

Created on 12 Oct 2020  路  1Comment  路  Source: pnp/pnpjs

Category

  • [ ] Enhancement
  • [x] Bug
  • [ ] Question
  • [ ] Documentation gap/issue

Version

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]

Expected / Desired Behavior / Question

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.

Observed Behavior

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.

Steps to Reproduce

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();
code fixed bug

Most helpful comment

Yep, this is a bug. Fixed and will be part of the next release. Thanks for letting us know!

>All comments

Yep, this is a bug. Fixed and will be part of the next release. Thanks for letting us know!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

muraray picture muraray  路  3Comments

simonagren picture simonagren  路  3Comments

Holden15 picture Holden15  路  3Comments

SpliceVW picture SpliceVW  路  3Comments

simkessy picture simkessy  路  3Comments