Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

PageIterator should allow for sending headers with each page request #311

Copy link
Copy link
@jasonjoh

Description

@jasonjoh
Issue body actions

Feature Request
PageIterator should expose an option to include headers each time it makes a nextLink request. Currently using PageIterator with calendar list requests when you also use the Prefer: outlook.timezone="" header causes a problem. The results in the first page (that you make yourself and include the header), return dateTime values in the requested time zones. Results in subsequent pages do not.
Describe the solution you'd like
Add this to PageIterator. One suggestion would be:
await pageIterator.iterate().withHeaders({
"Prefer": "outlook.timezone="Pacific Standard Time""
});

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Additional context
Repro code:
const startOfWeek = '2020-08-02T07:00:00';
const endOfWeek = '2020-08-09T07:00:00';

let response = await graphClient
.api('/me/calendarview')
// Set the Prefer=outlook.timezone header so date/times are in
// user's preferred time zone
.header("Prefer", outlook.timezone="Pacific Standard Time")
// Add the startDateTime and endDateTime query parameters
.query({ startDateTime: startOfWeek, endDateTime: endOfWeek })
// Select just the fields we are interested in
.select('subject,organizer,start,end')
// Sort the results by start, earliest first
.orderby('start/dateTime')
// Maximum 50 events in response
.top(5)
.get();

// If there are more results, use a PageIterator to get them all
if (response['@odata.nextLink']) {
console.log('Need to iterate');
let events = [];

const pageIterator = new MicrosoftGraph.PageIterator(
graphClient, response, (event) => {
events.push(event);
return true;
}
);

await pageIterator.iterate();

console.log(JSON.stringify(events));
} else {
console.log(JSON.stringify(response.value));
}

You'll note that the first 5 events have the times correct in Pacific, but the rest are in UTC.
AB#5628

Reactions are currently unavailable

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.