Forum Discussion
Create a Teams calendar event from a bot
Nikitha-MSFT Thanks, Using the Azure id i get this error response:
"code": "ErrorInvalidRequest",
"message": "The OData request is not supported.",
diegoSpace - Could you please share your request body what you are trying?
- diegoSpaceApr 15, 2020Brass Contributor
Nikitha-MSFT I used the example body from
https://docs.microsoft.com/en-us/graph/api/user-post-events?view=graph-rest-1.0&tabs=http
(updated date & timezone)
{
"subject": "Let's go for lunch",
"body": {
"contentType": "HTML",
"content": "Does late morning work for you?"
},
"start": {
"dateTime": "2020-04-15T12:00:00",
"timeZone": "Europe/Madrid"
},
"end": {
"dateTime": "2020-04-15T14:00:00",
"timeZone": "Europe/Madrid"
},
"location":{
"displayName":"Harry's Bar"
},
"attendees": [
{
"emailAddress": {
"address":"samanthab@contoso.onmicrosoft.com",
"name": "Samantha Booth"
},
"type": "required"
}
]
}- Trinetra-MSFTApr 15, 2020Former Employee
diegoSpace , Do you have required Calendar.ReadWrite permission in your access token? You can check that on jwt.io.
- diegoSpaceApr 15, 2020Brass Contributor
Trinetra-MSFT Thanks for your response, on jwt.io I could see my permissions, and there was no permission for Calendar. I added it in my app (Azure) and then retried:
"roles": [
"User.ReadWrite.All",
"Group.Read.All",
"Directory.ReadWrite.All",
"Directory.Read.All",
"User.Read.All",
"GroupMember.Read.All",
"Calendars.ReadWrite"
],But with that token I still have the error:
"The OData request is not supported."
Is "Calendars.ReadWrite" permission the only required? It is without '.All' (like the others), I have not found the '.All' one...
My raw request is:
PUT /v1.0/users/bcb3f5a......23a5925/calendar/events HTTP/1.1
Authorization: Bearer eyJ0eXAiOiJKV1Q.....EUquw
Host: graph.microsoft.com
Content-Type: application/json
Content-Length: 548{
"subject": "Let's go for lunch",
"body": {
"contentType": "HTML",
"content": "Does late morning work for you?"
},
"start": {
"dateTime": "2020-04-15T12:00:00",
"timeZone": "Europe/Madrid"
},
"end": {
"dateTime": "2020-04-15T14:00:00",
"timeZone": "Europe/Madrid"
},
"location":{
"displayName":"Harry's Bar"
},
"attendees": [
{
"emailAddress": {
"address":"samanthab@contoso.onmicrosoft.com",
"name": "Samantha Booth"
},
"type": "required"
}
]
}Thanks a lot,
Diego