Closed bhoomesh-spe closed 4 days ago
@juliemturner - Thanks for the response.
I have implemented as you had suggested and it is working as expected. Thanks for the same.
Now, I have faced one issue when I tried to get recurring events it threw me the below error. This request requires a time window specified by the query string parameters StartDateTime and EndDateTime.
Please check the code snippet for more clarification.
export const getAllRecurringEventInstances = async (currentUserMailBoxTimeZone, event) => {
const graph: GraphFI = getGraph();
const allEvents = [];
const startDateTime = event?.recurrence?.range?.startDate + "T" + event?.start.dateTime.split('T')[1];
const endDateTime = event?.recurrence?.range?.endDate + "T" + event?.end.dateTime.split('T')[1];
let events = await graph.me.events.getById(event.id).instances(startDateTime, endDateTime).using(InjectHeaders({
'Prefer': 'outlook.timezone="' + currentUserMailBoxTimeZone + '"'
})).top(999).paged();
allEvents.push(...events.value);
while (events.hasNext) {
events = await events.next();
allEvents.push(...events.value);
}
return allEvents;
};
Can you please help me on the same?
Thanks
@bhoomesh-spe - can you do a quick test without the paged()
and see if it works as expected?
This looks like we are stripping those params when we create the paged collection.
This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.
What version of PnPjs library you are using
3.x
Minor Version Number
3.15.0
Target environment
SharePoint Framework
Additional environment details
SharePoint Online, SPFx React
Question/Request
Hello Everyone,
I have implemented the below code to get the current user outlook event using PnP Graph API in the SPFx React project.
Currently I got the current logged in user's outlook event as expected.
But the event start time and end time is in the UTC time zone. I will need the same in the current user local time zone.
I have checked and found that I need to add something like the below in my PnP Graph API call to get the current user events from Outlook.
"Prefer":
outlook.timezone="Pacific Standard Time"
How can I pass the Prefer to my PnP Graph API call?
Can anyone help with the same?
Thanks