Timezone issues when scheduling a meeting using microsoft-graph - microsoft-graph-api

When I schedule a new meeting using Microsoft Graph Explorer, I get the wrong time.
If I call https://graph.microsoft.com/v1.0/me/mailboxsettings, I get my Time Zone: "timeZone": "W. Europe Standard Time".
If I then call https://graph.microsoft.com/v1.0/me/events with the payload:
{
"subject": "My event W. Europe Standard Time 3",
"start": {
"dateTime": "2019-04-02T16:01:03.353Z",
"timeZone": "W. Europe Standard Time"
},
"end": {
"dateTime": "2019-04-02T16:47:03.353Z",
"timeZone": "W. Europe Standard Time"
}
}
I get the scheduled meeting in my Outlook as expected, but the time is incorrect. The time I get in Outlook is 18:10 to 18:47.

When you put a Z at the end of the time, you're saying the time is UTC. You need to remove the time zone information from the time in order for it to get treated as a local time:
{
"subject": "My event W. Europe Standard Time 3",
"start": {
"dateTime": "2019-04-02T16:01:00",
"timeZone": "W. Europe Standard Time"
},
"end": {
"dateTime": "2019-04-02T16:47:00",
"timeZone": "W. Europe Standard Time"
}
}

Related

Controlling internal and external autoreplies

When I set mailboxsettigs|automaticRepliesSetting|status using MSGraph (for a shared mailbox) it seems to only affect the setting for internal recipients and there seems no syntax for dealing with internal/external recipients. What am I missing?
For external recipients you need to also set externalAudience to all.
PATCH /users/{id}/mailboxSettings
"automaticRepliesSetting": {
"status": "scheduled",
"externalAudience": "all",
"scheduledStartDateTime": {
"dateTime": "2023-02-15T02:00:00.0000000",
"timeZone": "UTC"
},
"scheduledEndDateTime": {
"dateTime": "2023-02-16T02:00:00.0000000",
"timeZone": "UTC"
},
"internalReplyMessage": "<html>\n<body>\n<p>I'm out<br>\n</p></body>\n</html>\n",
"externalReplyMessage": "<html>\n<body>\n<p>I'm out<br>\n</p></body>\n</html>\n"
}

With Exchange Web Services a calendar event can be created and assigned to a specific category while that same capability is missing from Graph

I have been using EWS to create appointments in both Exchange on-premise and Exchange online mailboxes that include a category value. I'm trying to migrate to Microsoft Graph since it's the recommended path according to Microsoft https://learn.microsoft.com/en-us/graph/migrate-exchange-web-services-overview
One of the EWS capabilities I can't replicate is creating a calendar event with a category.
The EWS Appointment class supports setting the category for the appointment - https://learn.microsoft.com/en-us/dotnet/api/microsoft.exchange.webservices.data.appointment?view=exchange-ews-api
When testing with Graph to create a calendar event, all responses to the posted requests include a null categories array as shown in the documentation - https://learn.microsoft.com/en-us/graph/api/user-post-events?view=graph-rest-1.0&tabs=csharp so it would seem that a request can be made with category.
Using the Microsoft Graph explorer to create a calendar event I naively add the categories property as an array and include a known category from the user's mailbox:
{
"subject": "Test",
"isAllDay": true,
"ShowAs":"Free",
"categories": [
{ "displayName":"Red Category", "color": "preset0" },
],
"start": {
"dateTime": "2022-11-08T00:00:00.0000000",
"timeZone": "Eastern Standard Time"
},
"end": {
"dateTime": "2022-11-09T00:00:00.0000000",
"timeZone": "Eastern Standard Time"
}
}
The response is always:
{
"error": {
"code": "UnableToDeserializePostBody",
"message": "were unable to deserialize "
}
}
I have also changed the property to a key:value which gets the same reponse.
{
"subject": "Test",
"isAllDay": true,
"ShowAs":"Free",
"category": "Red Category",
"start": {
"dateTime": "2022-11-08T00:00:00.0000000",
"timeZone": "Eastern Standard Time"
},
"end": {
"dateTime": "2022-11-09T00:00:00.0000000",
"timeZone": "Eastern Standard Time"
}
}
Does the Graph Create Event POST /users/{id | userPrincipalName}/calendars/{id}/events support including a category?
You were so close.
Categories is an array of strings. This will create the appointment with the Personal category, if there is no Personal category one will be created.
{
"subject": "Test",
"isAllDay": true,
"ShowAs": "Free",
"categories": [
"Personal"
],
"start": {
"dateTime": "2022-11-08T00:00:00.0000000",
"timeZone": "Eastern Standard Time"
},
"end": {
"dateTime": "2022-11-09T00:00:00.0000000",
"timeZone": "Eastern Standard Time"
}
}

Event not showing in attendee's calendar

I am using Microsft Graph to add a Calendar Event with an online meeting and I am getting a successful response.
The Event is not however showing in the attendee's calendar. Also, it is failing to send an email to the attendee. I can see the emails bouncing in the event organizer's mailbox.
URL:
/v1.0/users/admin#deovratj1990.onmicrosoft.com/events
Headers:
Authorization: Bearer [ACCESS_TOKEN]
Payload:
{
"start": {
"dateTime": "2021-03-02T16:30:00",
"timeZone": "India Standard Time"
},
"end": {
"dateTime": "2021-03-02T17:00:00",
"timeZone": "India Standard Time"
},
"subject": "Interview scheduled with Deovrat Candidate on Tue, March 02, 4:30 PM - 5:00 PM IST",
"body": {
"contentType": "HTML",
"content": "<body style=\"margin:0px; font-family:Arial\">\nHello,<br/><br/>\n\n\t Your are scheduled to interview Deovrat Candidate for Java Developer - Deovrat Recruiter.<br/>\n \n <br/>View Deovrat Candidate's profile and give your feedback. <br/>\n\t\t\thttps://east2.ripplehire.com/ripplehire/interviewer#list/token/73rHnVJ57kPO5YvJEn6V<br/>\n \n\t<p>When: Tuesday, 02 Mar 2021</p>\n\t<p>Type: Video Interview</p>\n\t\n<hr style=\"border: 1px dashed black;\" />\n\n\t<table style=\"width:100%\" >\n\t <thead>\n\t\t <tr>\n\t\t\t <th align=\"left\"><span style=\"font-weight: bold\">Time</span></th>\n\t\t\t <th align=\"left\"><span style=\"font-weight: bold\">Interviewer</span></th>\n\t\t\t \n\t\t </tr>\n\t </thead>\n\t <tbody>\n\n\t\t\t<tr>\n\t\t\t <td align=\"left\"> 4:30 PM - 5:00 PM IST</td>\n\t\t\t <td align=\"left\">interviewer1#deovratj1990.onmicrosoft.com</td>\n\t\t\t \n\t\t </tr>\n\t\t</tbody>\n\t</table>\n\n\t\n\n\t<p>Candidate contact Info</p>\n\t<hr style=\"border: 1px dashed black;\" />\n\t<p>Deovrat Candidate, jalgaonkar.deovrat#gmail.com</p>\n \t<br/><br/>\n <span style=\"text-decoration: none\"> Regards,<br/>\n \t<span>Deovrat Recruiter</span><br/>\n\t \t\t<span>admin#deovratj1990.onmicrosoft.com</span><br/>\n\t</body>"
},
"attendees": [
{
"emailAddress": {
"address": "interviewer1#deovratj1990.onmicrosoft.com"
},
"type": "required"
}
],
"isOnlineMeeting": true,
"onlineMeetingProvider": "teamsForBusiness"
}

Microsoft Event Graph API India dateTime timeZone issue

I am trying to create an Event through Microsoft Graph API but getting datetime and timezone issue
What I am sending in the body.
"start": {
"dateTime": "2020-08-25T09:52:00",
"timeZone": "India Standard Time"
},
"end": {
"dateTime": "2020-08-25T09:58:00",
"timeZone": "India Standard Time"
}
What I am getting in the response
"start": {
"dateTime": "2020-09-01T09:52:00.0000000",
"timeZone": "India Standard Time"
},
"end": {
"dateTime": "2020-09-01T09:58:00.0000000",
"timeZone": "India Standard Time"
}
Please suggest.
Thanks in advance.
I resolved it by sending payload like below
url: 'https://graph.microsoft.com/v1.0/me/events',
headers: {
Authorization: 'Bearer ' + token,
'Content-Type': 'application/json',
'SdkVersion': 'postman-graph/v1.0',
'outlook.timezone': 'Asia/Kolkata'
},
body: {
subject: json.w_title,
allowNewTimeProposals: true,
isOnlineMeeting: true,
onlineMeetingProvider: "teamsForBusiness",
body: {
"contentType": "HTML",
"content": "Online Webinar"
},
start: {
"dateTime": "2020-08-25T09:52:00",
"timeZone": "Asia/Kolkata"
},
end: {
"dateTime": "2020-08-25T09:58:00",
"timeZone": "Asia/Kolkata"
},
location: {
"displayName": "Bokaro Jharkhand"
}
}

MSGraph findMeetingTimes API return 500 Error

I am using the graph API's findmeetingTimes to get free/busy time.
If there is an event set in seconds in the time range within the range specified by the Timeslots parameter,500 error will be returned
For example, if I send following request :
POST https://graph.microsoft.com/v1.0/me/findMeetingTimes
{
"attendees": [],
"timeConstraint": {
"timeslots": [
{
"start": {
"dateTime": "2018-07-19T09:00:00.000Z",
"timeZone": "UTC"
},
"end": {
"dateTime": "2018-07-19T21:00:00.000Z",
"timeZone": "UTC"
}
}
]
},
"meetingDuration": "PT1H"
}
API returns following RESPONSE :
{
"error": {
"code": "ErrorInternalServerError",
"message": "An internal server error occurred. The operation failed.",
"innerError": {
"request-id": "43a1699f-2241-4c59-8450-826612466f07",
"date": "2018-07-19T02:16:22"
}
}
}
This is my Calencar(Only 1 event on July 19, 2018)
Get https://graph.microsoft.com/v1.0/me/calendarview?startdatetime=2018-07-19T00:00:00.000Z&enddatetime=2018-07-19T23:59:59.999Z
・
・
・
"start": {
"dateTime": "2018-07-19T12:00:00.0000000",
"timeZone": "UTC"
},
"end": {
"dateTime": "2018-07-19T12:33:33.0000000",
"timeZone": "UTC"
}
・
・
・
It also happens with outlookAPI
This seems like a bug to me.
Is this a known bug, and are there any plans to fix it?
Is there a known work around?
Try changing the timezone label in the time slot, UTC doesn't seem to work for some reason. At this point it's not clear whether it's a gap in the documentation or an issue with the API itself.
I opened a GitHub Issue to have Microsoft investigate

Resources