setting event organizer with Outlook Calendar REST API

◇◆丶佛笑我妖孽 提交于 2019-12-01 09:54:20

问题


I am using the Outlook REST API for creating events and sending its invitations, based on this documentation

I authenticate the logged in user, and send its Bearer token through the Authorization header of the request, and the json-formatted event on its content.

If I set the "Organizer" to another user rather than the authenticated one, as well as the "IsOrganizer" property to "false", it gets totally ignored and sets the current logged in user as the organizer.

Any clues of what could be happening? Is there another way of doing this?

Thank you!


回答1:


This is the correct behavior. You cannot create an event on User A's calendar but set the organizer to User B.




回答2:


I'm posting this in case someone else finds and needs an answer for this scenario...

You (Account A) can create a calendar event as someone else (Account B) through Office365 REST APIs as long as the account has permission to send as the other user account.

Here are the steps:

1) Call the Office365 REST API as follows,where {{{user2email}}} is the user you want the event to be created as (Account B's email address): https://outlook.office365.com/api/v1.0/users/{{{user2email}}}/calendar

This should return Account B's user's calendar ID.

2) Pass in your JSON - the following is an example of what I used during unit testing:

{
      "Subject": "Test - Created using Office365 Calendar REST API should be from Technology Notice",
      "IsOrganizer": "False",
      "Body": {
        "ContentType": "HTML",
        "Content": "This is where body copy goes HTML supported"
      },
      "Start": "2015-12-11T19:00:00Z",
      "End": "2015-12-11T20:00:00Z",
      "Attendees": [
        {
          "EmailAddress": {
            "Address": "attendee1@yourcompany.com",
            "Name": "Attendee One"
          },
          "Type": "Required"
        }
      ],
      "Organizer": {
        "EmailAddress": {
          "Address": "tnotice@yourcompany.com",
          "Name": "Technology Notice"
        }
      }
    }

'Technology Notice' will be who the calendar invite is from.

3) Use the ID from step 2 in your POST request, for example: https://outlook.office365.com/api/v1.0/users/{{{user2email}}}/calendars/{{{ID}}}/events

Note: Make sure you're sending the POST request as the authenticated user account (Account A) who's account the mailbox/calendar it actually belongs to.

If everything is right you should be able to send a calendar invite and have it show up as originating from Account B instead of Account A.

Hope this helps someone out.



来源:https://stackoverflow.com/questions/30462270/setting-event-organizer-with-outlook-calendar-rest-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!