setting event organizer with Outlook Calendar REST API

前端 未结 2 1385
太阳男子
太阳男子 2021-01-14 10:14

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 t

相关标签:
2条回答
  • 2021-01-14 10:48

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

    0 讨论(0)
  • 2021-01-14 10:50

    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.

    0 讨论(0)
提交回复
热议问题