Creating event returns ErrorPropertyValidationFailure - microsoft-graph-api

I'm trying to create an Event via Microsoft Graph by providing following JSON input:
{
"subject": "Test event",
"organizer": {
"emailAddress": {
"name": "Name 1",
"address": "name1#graffter.onmicrosoft.com"
}
},
"start": {
"dateTime": "2018-10-18T01:45:38",
"timeZone": "UTC"
},
"end": {
"dateTime": "2018-10-18T04:45:38",
"timeZone": "UTC"
},
"attendees": [
{
"emailAddress": {
"name": "Name 2",
"address": "name2#graffter.onmicrosoft.com"
},
"type": "required"
},
{
"emailAddress": {
"name": "room",
"address": "room#graffter.onmicrosoft.com"
},
"type": "resource"
}
],
"body": {
"content": "Prueba de evento",
"contentType": "HTML"
},
"location": {
"displayName": "room",
"locationEmailAddress": "room#graffter.onmicrosoft.com"
}
}
Sometimes, however, I'm getting the following error response (and I mean sometimes) :
{
"error": {
"code": "ErrorPropertyValidationFailure",
"message": "At least one property failed validation.",
"innerError": {
"request-id": "9f528d43-ed74-4c02-a29c-f01e47f24717",
"date": "2018-10-18T12:14:31"
}
}
}
So the thing is, with the same code and the same JSON request (changing dates of course), it sometimes worked while others times it fails.
I'm following the official documentation, I have all the permissions needed, and the access_token I'm using works perfectly with other API calls such as /messages.

Related

Microsoft Graph API Find meeting times the 1st attendee availability status showing free but for second attendee status showing unknown? how to fix?

Microsoft Graph API Find meeting times the 1st attendee availability status showing free but for second attendee status showing unknown how to show the availability status as free if both attendees are free?
note: while passing two attendees in the request then only 2nd attendee getting availability unknown.
Here Iam passing 2 attendees
Request Body:
"attendees": [
{
"type": "required",
"emailaddress": {
"name": "shanavaz",
"address": "shan#2vgl33.onmicrosoft.com"
}
},
{
"type": "required",
"emailaddress": {
"name": "Akhila",
"address": "ak#2vgl33.onmicrosoft.com"
}
}
],
"locationConstraint": {
"isRequired": false,
"suggestLocation": false,
"locations": []
},
"timeConstraint": {
"activityDomain": "work",
"timeSlots": [
{
"start": {
"dateTime": "2022-10-13T00:00:00.000Z",
"timeZone": "India Standard Time"
},
"end": {
"dateTime": "2022-10-13T23:59:00.000Z",
"timeZone": "India Standard Time"
}
}
]
},
"isOrganizerOptional": "true",
"meetingDuration": "PT30M",
"returnSuggestionReasons": "true",
"minimumAttendeePercentage": "50",
"maxCandidates": 36
}
**Response:**
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.meetingTimeSuggestionsResult",
"emptySuggestionsReason": "",
"meetingTimeSuggestions": [
{
"confidence": 74.5,
"organizerAvailability": "busy",
"suggestionReason": "Suggested because even when you are busy most attendees are available.",
"attendeeAvailability": [
{
"availability": "free",
"attendee": {
"emailAddress": {
"address": "shan#2vgl33.onmicrosoft.com"
}
}
},
{
"availability": "unknown",
"attendee": {
"emailAddress": {
"address": "ak#2vgl33.onmicrosoft.com"
}
}
}
],
"locations": [],
"meetingTimeSlot": {
"start": {
"dateTime": "2022-10-13T05:30:00.0000000",
"timeZone": "India Standard Time"
},
"end": {
"dateTime": "2022-10-13T06:00:00.0000000",
"timeZone": "India Standard Time"
}
}
},
{
"confidence": 74.5,
"organizerAvailability": "busy",
"suggestionReason": "Suggested because even when you are busy most attendees are available.",
"attendeeAvailability": [
{
"availability": "free",
"attendee": {
"emailAddress": {
"address": "shan#2vgl33.onmicrosoft.com"
}
}
},
{
"availability": "unknown",
"attendee": {
"emailAddress": {
"address": "ak#2vgl33.onmicrosoft.com"
}
}
}
],
"locations": [],
"meetingTimeSlot": {
"start": {
"dateTime": "2022-10-13T06:30:00.0000000",
"timeZone": "India Standard Time"
},
"end": {
"dateTime": "2022-10-13T07:00:00.0000000",
"timeZone": "India Standard Time"
}
}
}
]
}```

Microsoft Graph API creating recurring event returns 500

I'm writing an app that synchronizes with Office365's events using the Microsoft Graph API v1.0.
When creating a single event, the event gets created as expected:
Response Status Code: 201 Created
Request URL: https://graph.microsoft.com/v1.0/me/calendars/<myCalendarId>/events
Request Method: POST
Request Payload:
{
"subject": "single event",
"start": {
"dateTime": "2020-02-15T09:00:00",
"timeZone": "Europe/Berlin"
},
"end": {
"dateTime": "2020-02-15T10:00:00",
"timeZone": "Europe/Berlin"
},
"attendees": [],
"type": "singleInstance",
"location": {
"displayName": null
},
"recurrence": null
}
If, however, I send a create request for a recurring event, I get a error response.
Response Status Code: 500 Internal Server Error
Request URL: https://graph.microsoft.com/v1.0/me/calendars/<myCalendarId>/events
Request Method: POST
Request Payload:
{
"subject": "test recurring event",
"start": {
"dateTime": "2020-02-14T09:00:00",
"timeZone": "Europe/Berlin"
},
"end": {
"dateTime": "2020-02-14T10:00:00",
"timeZone": "Europe/Berlin"
},
"attendees": [],
"location": {
"displayName": null
},
"recurrence": {
"pattern": {
"daysOfWeek": [],
"type": "daily"
},
"range": {
"numberOfOccurrences": "2",
"recurrenceTimeZone": "Europe/Berlin",
"startDate": "2020-02-14",
"type": "numbered"
}
}
}
Response Body:
{
"error": {
"code": "ErrorInternalServerError",
"message": "An internal server error occurred. The operation failed.",
"innerError": {
"request-id": "2d97931c-e08c-45a8-8167-5849df53a694",
"date": "2020-02-14T14:38:28"
}
}
}
I find it strange that the addition of the recurrence settings causes an Internal Server Error.
What can I do to create a recurring event with the API?
If you want to create a recurring event that occurs daily, instead of setting pattern in the following way:
"pattern": {
"daysOfWeek": [],
"type": "daily"
},
Please set pattern this way:
"pattern": {
"type": "daily",
"interval": 1
},
Creating a daily recurrence pattern is described here in the conceptual docs. Within the next day, there will also be a REST example in the reference docs.

Outlook event RSVP graph api issue

Created an Event with Microsoft Graph:
{
"subject": "TEST",
"body": {
"contentType": "HTML",
"content": "test event respond"
},
"start": {
"dateTime": "2019-05-22T00:00:00",
"timeZone": "Asia/Kolkata"
},
"end": {
"dateTime": "2019-05-22T00:00:00",
"timeZone": "Asia/Kolkata"
},
"location": { "displayName": "Leena AI" },
"attendees": [
{
"emailAddress": {
"address": "sachin#live.com",
"name": "Sachin Goel"
},
"type": "optional"
}
],
"isReminderOn": false,
"reminderMinutesBeforeStart": 15
}
If I try to accept the event from sachin#live.com user it throws an error:
{
"error": {
"code": "ErrorItemNotFound",
"message": "The specified object was not found in the store.",
"innerError": {
"request-id": "485528b0-dbbe-42f5-80c0-5fc91477fc31",
"date": "2019-04-30T07:11:58"
}
}
}
sample request:
https://graph.microsoft.com/v1.0/me/events/{eventId}/accept
{
"comment" : "respond from api"
}
It results in NotFoundError but this works from UI. I have tried different solution (updating permission, primary calendar) but nothing works
Are there any constraints with this flow at the API level?
The Event ID for the Event you created in your mailbox is not going to be the same as the Event ID in the sachin#live.com mailbox.
You need to find the message with the sachin#live.com mailbox and then accept that id.

meetingDuration in findmeeting times api

Microsoft Graph API
Findmeeting times api
what happens when meeting time is less than 30mins(like 10mins)?Because Findmeeting Times search only for every 30 mins. It does not search times in between. For example I want for 10 mins meeting with someone 8 to 10. It returns 8.00 t0 8.10 and 8.30 to 8.40.Why can't it return 8.10 t0 8.20 and 8.20 to 8.30 ?Here is the inputs and outputs
Input
{
"attendees": [
{
"type": "required",
"emailAddress": {
"address": "kumar.muthu#mic123.com",
"name": "kumar muthu"
},
}
],
"timeConstraint": {
"activityDomain": "unrestricted",
"timeslots": [
{
"start": {
"dateTime": "2018-03-27T18:00:00",
"timeZone": "India Standard Time"
},
"end": {
"dateTime": "2018-03-27T18:30:00",
"timeZone": "India Standard Time"
}
}
]
},
"meetingDuration": "PT0H10M"
}
Output
{
"#odata.context": "https://graph.microsoft.com/v1.0/$metadata#microsoft.graph.meetingTimeSuggestionsResult",
"emptySuggestionsReason": "",
"meetingTimeSuggestions": [
{
"confidence": 100,
"organizerAvailability": "free",
"meetingTimeSlot": {
"start": {
"dateTime": "2018-03-27T18:00:00.0000000",
"timeZone": "India Standard Time"
},
"end": {
"dateTime": "2018-03-27T18:10:00.0000000",
"timeZone": "India Standard Time"
}
},
"attendeeAvailability": [
{
"availability": "free",
"attendee": {
"type": "required",
"emailAddress": {
"address": "kumar.muthu#mic123.com"
}
}
}
],
"locations": [
{
"displayName": "RM-CHN-Training-Room1",
"locationEmailAddress": "RM-Chennai.Trainning-Room1#mic123.com"
},
{
"displayName": "DEV BAY",
"locationEmailAddress": ""
},
{
"displayName": "Conference room near Security",
"locationEmailAddress": ""
},
{
"displayName": "Any Phone Booth or WebEx",
"locationEmailAddress": ""
},
{
"displayName": "Austin",
"locationEmailAddress": ""
}
]
}
]
}
why it doesn't send timings between 8.10 to 8.30
I can't tell you why the limitation is there. It's not documented in the Find meeting times API documentation. But Outlook, which presumably uses the same or a similar API, has the limitation in the UI as well:
I can see that your filter for 10minutes worked, now the results appear limited due to some default filters applied, try adding these params and play with the results.
"isOrganizerOptional": "true",
"returnSuggestionReasons": "true",
"minimumAttendeePercentage": "100"
Hope it helped.

"Overlaps are not supported within TimeSlots" error in Outlook Calendar REST API

From yesterday I started receiving an error in my service (production environment) when trying to call Outlook Calendar REST API endpoint:
POST https://outlook.office.com/api/v2.0/me/findMeetingTimes
with following request body:
{
"Attendees": [
{
"Type": "optional",
"EmailAddress": {
"Address": "...",
"Name": null
}
},
{
"Type": "required",
"EmailAddress": {
"Address": "...",
"Name": null
}
}
],
"LocationConstraint": {
"IsRequired": true,
"SuggestLocation": false,
"Locations": [
{
"DisplayName": "..."
}
]
},
"TimeConstraint": {
"Timeslots": [
{
"Start": {
"DateTime": "2017-05-05T00:00:00",
"TimeZone": "UTC"
},
"End": {
"DateTime": "2017-05-05T21:59:59",
"TimeZone": "UTC"
}
}
]
},
"MaxCandidates": 1000,
"MeetingDuration": "PT30M",
"IsOrganizerOptional": true }
Here is the response I get:
{
"error": {
"code": "ErrorInternalServerError",
"message": "Invalid value for arg:Overlaps are not supported within TimeSlots, value:
{\"start\":2017-05-04T22:00:00Z,
\"min\":1440}
\r\nParameter name: Overlaps are not supported within TimeSlots"
}
}
Everything was working fine with until yesterday. There were no changes in my service codebase. It seems to be related with some changes in O365 API itself but there are no recent updates in documentation...
Any idea what might be wrong?
UPDATE: Without any modification in the request the server response is now:
{
"error": {
"code": "ErrorInternalServerError",
"message": "Index was outside the bounds of the array."
}
}

Resources