I am using outlook calendar rest API. While creating an event the attendee is added successfully.
Later if I wish to update the event and add one more attendee I am using PATCH. But it removes any previous attendee of that event.
URL to create the event
POST https://outlook.office.com/api/v2.0/me/events
Body param
{
"Subject": "Discuss the Calendar REST API 2",
"Body": {
"ContentType": "HTML",
"Content": "I think it will meet our requirements!"
},
"Start": {
"DateTime": "2017-04-25T18:00:00",
"TimeZone": "Asia/Kolkata"
},
"End": {
"DateTime": "2017-04-25T19:00:00",
"TimeZone": "Asia/Kolkata"
},
"Attendees": [
{
"EmailAddress": {
"Address": "[email protected]",
"Name": "ABC"
},
"Type": "Required"
}
]
}
URL to update event
PATCH https://outlook.office.com/api/v2.0/me/events/{eventId}
Body param
{
"Attendees": [
{
"EmailAddress": {
"Address": "[email protected]",
"Name": "def"
},
"Type": "Required"
}
]
}
After executing this the previous attendee "[email protected]" gets removed and receives a cancelled event mail and the new attendee "[email protected]" gets added.
Please help me to solve this issue.
Yes, it is the expected behavior. If you are using PATCH api, you need to give it the list of the attendees that you have added before. Otherwise, it thinks that you have removed them. So when you are using the GET api (to get the event), save the list of the attendees and add or remove from this list, then send it with the PATCH call.