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.
Related
We are using https://graph.microsoft.com/v1.0/me/calendar/events for creating Calendar events. What we are trying to achieve additionally is to send an adaptive card as attachment. We are using below code as POST body
{
"subject": null,
"body": {
"contentType": "html",
"content": "<attachment id=\"74d20c7f34aa4a7fb74e2b30004247c5\"></attachment>"
},
"attachments": [
{
"id": "74d20c7f34aa4a7fb74e2b30004247c5",
"contentType": "application/vnd.microsoft.card.adaptive",
"contentUrl": null,
"content": "{\"$schema\":\"http://adaptivecards.io/schemas/adaptive-card.json\",\"version\":\"1.5\",\"type\":\"AdaptiveCard\",\"body\":[{\"type\":\"Container\",\"style\":\"emphasis\",\"items\":[{\"type\":\"TextBlock\",\"text\":\"TheEYorganizationtodayannouncesthedetailsofthe52womenfounders\",\"wrap\":true},{\"type\":\"ColumnSet\",\"columns\":[{\"style\":\"default\",\"width\":\"stretch\",\"items\":[{\"type\":\"ColumnSet\",\"columns\":[{\"items\":[{\"type\":\"Image\",\"width\":\"200px\",\"url\":\"https://tse3.mm.bing.net/th/id/OIP._awI5wQIVTy1k8QdHtpSWQHaEK?w=292&h=180&c=7&r=0&o=5&dpr=1.3&pid=1.7\"}],\"type\":\"Column\",\"width\":\"auto\"},{\"items\":[{\"type\":\"TextBlock\",\"size\":\"Medium\",\"weight\":\"Bolder\",\"text\":\"SomeText\",\"wrap\":true},{\"type\":\"TextBlock\",\"size\":\"Medium\",\"weight\":\"Bolder\",\"text\":\"[https://adaptivecards.io](https://adaptivecards.io)\",\"wrap\":true}],\"type\":\"Column\",\"width\":\"auto\"}]}],\"minHeight\":\"100px\",\"type\":\"Column\"}]}]}]}",
"name": null,
"thumbnailUrl": null
}
],
"start": {
"dateTime": "2022-11-18T12:00:00",
"timeZone": "Pacific Standard Time"
},
"end": {
"dateTime": "2022-11-18T12:30:00",
"timeZone": "Pacific Standard Time"
},
"location": {
"displayName": "Harry's Bar"
},
"attendees": [
{
"emailAddress": {
"address": "xero.01234#contoso.com",
"name": "Orex"
},
"type": "required"
}
],
"isOnlineMeeting": true,
"onlineMeetingProvider": "teamsForBusiness"}
Using above body, I am getting below error
{
"error": {
"code": "UnableToDeserializePostBody",
"message": "were unable to deserialize "
}}
As I understand this has something to do with the JSON I am passing as content inside attachment, I want to know if calendar invites endpoint supports adaptive card or not or is there any way, we can send adaptive card (using .NET SDK) to mail or events in outlook
Thanks, in advance
You can send actionable messages via emails only, see Supported scenarios for more information.
I am trying to create an event in a calendar from a Powershell script. It needs to add the calendar event to the organizer's calendar and then to a list of attendees. Below is what I am sending in the body of the request.
{
"subject": "Let's go for lunch",
"IsOrganizer": "true",
"body": {
"contentType": "HTML",
"content": "Does noon work for you?"
},
"start": {
"dateTime": "2020-08-31T12:00:00",
"timeZone": "Pacific Standard Time"
},
"end": {
"dateTime": "2020-08-31T14:00:00",
"timeZone": "Pacific Standard Time"
},
"location":{
"displayName":"Harry's Bar"
},
"attendees": [
{
"emailAddress": {
"address":"attendee1#attendeeadress.com",
"name": "Attendee1"
},
"type": "required",
"status": {
"response": "none",
"time": "0001-01-01T00:00:00Z"
}
},
{
"emailAddress": {
"address":"attendee2#attendeeadress.com",
"name": "Attendee2"
},
"type": "required",
"status": {
"response": "none",
"time": "0001-01-01T00:00:00Z"
}
}
],
"organizer":{
"emailAddress":{
"name":"Specific Calendar",
"address":"calendarname#organizerorganization.onmicrosoft.com"
}
},
"allowNewTimeProposals": true
}
It appears successfully on the calendar of the attendees but not on the main organizer's calendar. Can anyone tell me what I am doing wrong and how I can get this to appear on the main organizer's calendar?
Thanks!
UPDATE - This is how I am getting the user token.
$Body = #{
'client_id' = 'my_client_id'
'scope' = 'https://graph.microsoft.com/.default'
'client_secret' = 'my_client_secret'
'grant_type' = 'password'
'userName' = 'calendarname#organizerorganization.onmicrosoft.com'
'password' = 'password'
}
It is now my understanding that this user should be set as the organizer of an event by default.
You can create an event using ROPC flow which gives you the user access token and using it you can call the /events endpoint with your payload as shown below.
POST https://graph.microsoft.com/v1.0/me/calendar/events
If you create an event with this token and give username as calendarname#organization.onmicrosoft.com this will be the organizer of the event.
And you can update 'subject', 'body/content' but you cannot update the event's 'start' and 'end' properties which is already a finished event.
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.
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.
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."
}
}