Hi @Anonymous
You were getting "The OData request is not supported." error message because you were using calendars
in this Graph API endpoint https://graph.microsoft.com/v1.0/users/<<upn>>/calendars/events
If you are using calendars
you need to provide {calendar-id}
in Graph API endpoint i.e.
GET /users/{id | userPrincipalName}/calendars/{id}/events
When you are using this https://graph.microsoft.com/v1.0/users/<<upn>>/calendar/events
Graph API endpoint this will create event in your default calendar.
Also, as you have mentioned you are getting "UnableToDeserializePostBody" error now.
This error generally occurs when request body is invalid, or you are using property which are not present in event resource type properties.
Please refer to the below sample request to create an event in the specified time zone:
POST https://graph.microsoft.com/v1.0/me/events
Prefer: outlook.timezone="Pacific Standard Time"
Content-type: application/json
{
"subject": "Let's go for lunch",
"body": {
"contentType": "HTML",
"content": "Does noon work for you?"
},
"start": {
"dateTime": "2023-03-15T12:00:00",
"timeZone": "Pacific Standard Time"
},
"end": {
"dateTime": "2023-03-15T14:00:00",
"timeZone": "Pacific Standard Time"
},
"location":{
"displayName":"Harry's Bar"
},
"attendees": [
{
"emailAddress": {
"address":"******@contoso.onmicrosoft.com",
"name": "Samantha Booth"
},
"type": "required"
}
],
"allowNewTimeProposals": true
}
Reference documentation: https://learn.microsoft.com/en-us/graph/api/user-post-events?view=graph-rest-1.0&tabs=http#examples
If you are still facing any issue, please provide screenshot of the request body which you are using along with the error message.
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.