Controlling internal and external autoreplies - microsoft-graph-api

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"
}

Related

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"
}
}

Which property is used to determin whether to allow forwarding an event message in graph api?

When I get a Message or Event object, I don't see any property that seems to be related to AllowForward. Tried both v1.0 and beta.
There is no strongly typed property so you need to use the Extended property for this eg to send a Meeting with no forward
{
"subject": "My event",
"start": {
"dateTime": "2020-10-13T04:55:36.463Z",
"timeZone": "UTC"
},
"end": {
"dateTime": "2020-10-20T04:55:36.463Z",
"timeZone": "UTC"
},
"attendees": [
{
"emailAddress": {
"address":"blah#domain.com",
"name": "gs"
},
"type": "required"
}
],
"SingleValueExtendedProperties": [
{
"PropertyId": "Boolean {00020329-0000-0000-C000-000000000046} Name DoNotForward",
"Value": "true"
}
]
}
Then to retrieve that property with an event use
https://graph.microsoft.com/v1.0/me/events?$expand=SingleValueExtendedProperties($filter%20%3D%20(id%20eq%20'Boolean%20%7B00020329-0000-0000-C000-000000000046%7D%20Name%20DoNotForward'))

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"
}
}

Microsoft Graph findMeetingTimes throws ErrorInternalServerError

When looking for an available meeting time the server returns a 500 without further explanation.
Request: POST https://graph.microsoft.com/v1.0/me/findMeetingTimes
{
"locationConstraint": {
"isRequired": "true",
"suggestLocation": "false",
"locations": [
{
"resolveAvailability": "true",
"locationEmailAddress": "..."
}
]
},
"timeConstraint": {
"activityDomain":"unrestricted",
"timeslots": [
{
"start": {
"dateTime": "2018-08-24T16:00:00",
"timeZone": "UTC"
},
"end": {
"dateTime": "2018-08-24T23:59:59",
"timeZone": "UTC"
}
}
]
}
}
Response:
{
"error": {
"code": "ErrorInternalServerError",
"message": "An internal server error occurred. The operation failed.",
"innerError": {
"request-id": "9e628ded-5750-497e-b54e-efe9b7184403",
"date": "2018-08-24T16:35:30"
}
}
}
It seems findMeetingTimes can't handle meetings which have a start or end dateTime with milliseconds. Also seconds need to be truncated to 00.
Works
"dateTime": "2018-08-24T16:00:00",
Breaks findMeetingTimes
"dateTime": "2018-08-24T16:00:00.791",
According to your descriptions, I suppose you want to look for an available meeting time.
Base on my test, If we set the value of the “start to end” time is less than the value of 'meetingDuration' Field. I got same error as you described.
If no meeting duration is specified, findMeetingTimes uses the default of 30 minutes.
From test above, we should set value of “start to end” time greater than the value of the 'meetingDuration' Field. Or greater than 30 if 'meetingDuration' was no set (because by default it will be 30 minutes

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