2

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": "abc@xyz.com",
        "Name": "ABC"
      },
      "Type": "Required"
    }
  ]
}

URL to update event

PATCH https://outlook.office.com/api/v2.0/me/events/{eventId}

Body param

{
  "Attendees": [
    {
      "EmailAddress": {
        "Address": "def@xyz.com",
        "Name": "def"
      },
      "Type": "Required"
    }
 ]
}

After executing this the previous attendee "abc@xyz.com" gets removed and receives a cancelled event mail and the new attendee "def@xyz.com" gets added.

Please help me to solve this issue.

Harsh Jain
  • 35
  • 10

1 Answers1

3

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.

AidaNow
  • 598
  • 5
  • 12
  • 1
    Is there any way to add just one attendee without passing the list of all the existing attendees – Harsh Jain Apr 24 '17 at 17:15
  • 1
    No, the attendees array gets overridden by the PATCH api, therefore, if the old attendees are not in the new array, it assumes that you have removed them. That makes sense, otherwise, how could you remove an attendee from an event? (since we don't have delete attendee api call) – AidaNow Apr 24 '17 at 17:54
  • Suppose I have 500 attendees in my event. If I wish to add just one I have to send data of all existing 500 attendee. Will it not affect the performance of my application? – Harsh Jain Apr 25 '17 at 01:52
  • There is one more problem I am facing. If I create an event, and later I send a patch request changing the response of the attendee. eg. { "Attendees": [ { "Type": "Required", "Status": { Response": "Accepted", "Time": "0001-01-01T00:00:00Z" }, EmailAddress": { "Name": "abc", "Address": "abc@xyz.com" } } ] } Then the accepted response is shown in organizer's calendar, but not in attendee's calendar. How can I accept a meeting invite in attendee's calendar as well. – Harsh Jain Apr 25 '17 at 08:32
  • Your first question about having like 500 attendees, this would not create any performance issue, because your array is just a simple array of email addresses. About your second question, are you trying to accept/decline a meeting request on behalf of an attendee? I don't think it is possible. The attendee himself/herself has to response to the request using the api calls listed here: https://msdn.microsoft.com/en-us/office/office365/api/calendar-rest-operations#RespndToEvents Let me know if you have questions on how to use them! – AidaNow Apr 25 '17 at 15:34
  • Thankyou so much for your response. Regarding accepting the invite on behalf of attendee: If the attendee needs to accept that invite, will he/she have to register an app, get auth code, access token and follow all those procedure, or can we have some way by which attendee can use the organizer's auth code and other tokens. I might sound a little confusing but hoping you understand what I mean to say. – Harsh Jain Apr 26 '17 at 04:32
  • When you invite a person to your meeting, he/she will receive an email with the response options (accept, tentative, decline). Now if that person is using your app and is authenticated, he can respond using the api calls. If not, he can simply check his email in "outlook.office365.com" or outlook client, or Gmail,... and respond from there. Does this answer your question? – AidaNow Apr 26 '17 at 14:44
  • Sorry, but I wasn't able to understand what "if that person is using your app and is authenticated" actually mean. Can a attendee use my api call (including my access_token) to accept or reject an invite on his calendar? Please forgive me if I sound too dumb, but I am confused. This is so because while using Google calendar API, I (organizer) was able to accept an invite on attendee's calendar. Is this possible using outlook API? – Harsh Jain Apr 28 '17 at 04:18
  • By being authenticated, I meant if the user has a valid token. I don't think you will be able to accept/decline a meeting on behalf of the attendee in Outlook calendar. – AidaNow May 01 '17 at 14:00
  • User will only have a valid token if he registers in appsdev of microsoft. Am I right? I think there is no way using which the organizer can accept/decline the meeting response for attendee using his/her own credentials and access token. – Harsh Jain May 02 '17 at 10:42
  • You are right, The organizer cannot respond on behalf of the attendee with his own token. – AidaNow May 02 '17 at 15:41
  • ok, Thankyou for your valuable responses and your time as well. – Harsh Jain May 03 '17 at 06:05