Forum Discussion
Create a Teams calendar event from a bot
diegoSpace , Do you have required Calendar.ReadWrite permission in your access token? You can check that on jwt.io.
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
- Trinetra-MSFTApr 29, 2020Former Employee
diegoSpace , That is a webLink for sure it will work in web only, If you want to open within Teams you can use joinWebUrl that will open within Teams Desktop client.
- diegoSpaceApr 20, 2020Brass Contributor
Trinetra-MSFT If I use microsoftTeams.executeDeepLink(webLink) in my Teams task the created event is open but in a browser (not in Teams client I mean):
https://outlook.office365.com/calendar/item/...The webLink is: https://outlook.office365.com/owa/?itemid=AAMkADBiNDA2...AAA%3D&exvsurl=1&path=/calendar/item
Thanks,
Diego
- Trinetra-MSFTApr 20, 2020Former Employee
diegoSpace , I've not seen this but I assume that you can try to deep link the webLink Url with Teams
- diegoSpaceApr 20, 2020Brass Contributor
Trinetra-MSFT Thanks. Is it possible to open Teams Calendar view programatically (or even recently created event) once I receive the event creation response? My Teams event is created from a Messaging extension dialog, and I would like to open it once created
- Trinetra-MSFTApr 17, 2020Former Employee
diegoSpace , If you are looking to Create a Event in user calendar you can use v1.0 but if you want to get the joinWebUrl too than go for beta version. create event with online meeting provider api is in beta version.
- diegoSpaceApr 16, 2020Brass Contributor
Trinetra-MSFT Thanks for your response, that was the problem. I don't know why i was using PUT (i think I see it somewhere), but event documentation says clearly 'POST'.
By the way, which version of Graph API should I used? 1.0 or beta?
Thanks a lot!
Diego
- Trinetra-MSFTApr 15, 2020Former Employee
diegoSpace , I see you are hitting the Put request , Ideally it should be POST:
POST /v1.0/users/{UserPrincipleName}/calendar/events. Try with this and let me know, how it goes,
Please take a look at Example 5.