Upravit

Sdílet prostřednictvím


Update event

Namespace: microsoft.graph

Important

APIs under the /beta version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported. To determine whether an API is available in v1.0, use the Version selector.

Update the properties of the event object.

This API is available in the following national cloud deployments.

Global service US Government L4 US Government L5 (DOD) China operated by 21Vianet

Notes for updating specific properties

Note the following behaviors or recommendations when updating the corresponding properties:

  • attendees property and meeting updates

    • An event update that includes only the attendees property in the request body sends a meeting update to only the attendees that have changed.
    • An event update that removes an attendee specified as a member of a distribution list sends a meeting update to all the attendees.
  • body property and online meetings

    Before updating the body of an event that has been set up as an online meeting, be sure to first get the body property, apply the appropriate changes to the content, and preserve the meeting blob for online meeting. Inadvertently removing the meeting blob from the body would disable meeting online.

  • end and start properties and their time zones

    When updating the time zone of the start or end time of an event, first find the supported time zones to make sure you set only time zones that have been configured for the user's mailbox server.

Permissions

One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.

Permission type Permissions (from least to most privileged)
Delegated (work or school account) Calendars.ReadWrite
Delegated (personal Microsoft account) Calendars.ReadWrite
Application Calendars.ReadWrite

HTTP request

PATCH /me/events/{id}
PATCH /users/{id | userPrincipalName}/events/{id}
PATCH /groups/{id}/events/{id}

PATCH /me/calendar/events/{id}
PATCH /users/{id | userPrincipalName}/calendar/events/{id}
PATCH /groups/{id}/calendar/events/{id}

PATCH /me/calendars/{id}/events/{id}
PATCH /users/{id | userPrincipalName}/calendars/{id}/events/{id}

PATCH /me/calendarGroups/{id}/calendars/{id}/events/{id}
PATCH /users/{id | userPrincipalName}/calendarGroups/{id}/calendars/{id}/events/{id}

Request headers

Name Type Description
Authorization string Bearer {token}. Required. Learn more about authentication and authorization.

Request body

In the request body, supply the values for relevant fields that should be updated. Existing properties that are not included in the request body will maintain their previous values or be recalculated based on changes to other property values. For best performance you shouldn't include existing values that haven't changed.

Property Type Description
attendees Attendee The collection of attendees for the event. See additional notes for updating specific properties.
body ItemBody The body of the message associated with the event. See additional notes for updating specific properties.
categories String collection The categories associated with the event.
end DateTimeTimeZone The date, time, and time zone that the event ends. See additional notes for updating specific properties.
hideAttendees Boolean When set to true, each attendee only sees themselves in the meeting request and meeting Tracking list. Default is false.
importance String The importance of the event. Possible values are: low, normal, high.
isAllDay Boolean Set to true if the event lasts all day. If true, regardless of whether it's a single-day or multi-day event, start and end time must be set to midnight and be in the same time zone.
isOnlineMeeting Boolean True if this event has online meeting information, false otherwise. Default is false. Optional.
isReminderOn Boolean Set to true if an alert is set to remind the user of the event.
location Location The location of the event.
locations Location collection The locations where the event is held or attended from. The location and locations properties always correspond with each other. If you update the location property, any prior locations in the locations collection would be removed and replaced by the new location value.
onlineMeetingProvider onlineMeetingProviderType Represents the online meeting service provider. The possible values are teamsForBusiness, skypeForBusiness, and skypeForConsumer. Optional.
recurrence PatternedRecurrence The recurrence pattern for the event.
reminderMinutesBeforeStart Int32 The number of minutes before the event start time that the reminder alert occurs.
responseRequested Boolean Set to true if the sender would like a response when the event is accepted or declined.
sensitivity String Possible values are: normal, personal, private, confidential.
showAs String The status to show. Possible values are: free , tentative, busy, oof, workingElsewhere, unknown.
start DateTimeTimeZone The start date, time, and time zone of the event. See additional notes for updating specific properties.
subject String The text of the event's subject line.

Because the event resource supports extensions, you can use the PATCH operation to add, update, or delete your own app-specific data in custom properties of an extension in an existing event instance.

If the event you're updating is the master event of a recurring series, contains multiple attendees, and has instances that have been updated separately, multiple notification emails will be sent out: one for the master series and one per instance that has been updated.

Response

If successful, this method returns a 200 OK response code and updated event object in the response body.

Note: This method can return an HTTP 400 Bad Request response with an error code of ErrorOccurrenceCrossingBoundary and the following error message: Modified occurrence is crossing or overlapping adjacent occurrence. This indicates that the update violates the following Outlook restriction on recurrence exceptions: an occurrence cannot be moved to or before the day of the previous occurrence, and cannot be moved to or after the day of the following occurrence.

Example

Request

The following example shows a request.

PATCH https://graph.microsoft.com/beta/me/events/{id}
Content-type: application/json

{
  "originalStartTimeZone": "originalStartTimeZone-value",
  "originalEndTimeZone": "originalEndTimeZone-value",
  "responseStatus": {
    "response": "",
    "time": "2016-10-19T10:37:00Z"
  },
  "recurrence": null, 
  "reminderMinutesBeforeStart": 99,
  "isOnlineMeeting": true,
  "onlineMeetingProvider": "teamsForBusiness",
  "isReminderOn": true,
  "hideAttendees": false,
  "categories": ["Red category"]
}

Response

The following example shows the response.

Note: The response object shown here might be shortened for readability.

HTTP/1.1 200 OK
Content-type: application/json

{
  "originalStartTimeZone": "originalStartTimeZone-value",
  "originalEndTimeZone": "originalEndTimeZone-value",
  "responseStatus": {
    "response": "",
    "time": "2016-10-19T10:37:00Z"
  },
  "recurrence": null,
  "iCalUId": "040000008200E00074=",
  "uid": "040000008200E00074=",
  "reminderMinutesBeforeStart": 99,
  "isOnlineMeeting": true,
  "onlineMeetingProvider": "teamsForBusiness",
  "isReminderOn": true,
  "hideAttendees": false,
  "onlineMeeting": {
        "joinUrl": "https://teams.microsoft.com/l/meetup-join/19%3ameeting_NzIyNzhlMGEtM2YyZC00ZmY0LTlhNzUtZmZjNWFmZGNlNzE2%40thread.v2/0?context=%7b%22Tid%22%3a%2272f988bf-86f1-41af-91ab-2d7cd011db47%22%2c%22Oid%22%3a%22bc55b173-cff6-457d-b7a1-64bda7d7581a%22%7d",
        "conferenceId": "177513992",
        "tollNumber": "+91 22 6241 6885"
    }
}