setting event organizer with Outlook Calendar REST API

那年仲夏 提交于 2019-12-01 12:09:04

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

Sergio S

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.

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