Update calendar
Namespace: microsoft.graph
Update the properties of a calendar object. The calendar can be one for a user, or the default calendar of a Microsoft 365 group.
This API is available in the following national cloud deployments.
Global service | US Government L4 | US Government L5 (DOD) | China operated by 21Vianet |
---|---|---|---|
✅ | ✅ | ✅ | ✅ |
Permissions
Depending on the type of calendar that the event is in and the permission type (delegated or application) requested, one of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
Calendar | Delegated (work or school account) | Delegated (personal Microsoft account) | Application |
---|---|---|---|
user calendar | Calendars.ReadWrite | Calendars.ReadWrite | Calendars.ReadWrite |
group calendar | Group.ReadWrite.All | Not supported. | Not supported. |
HTTP request
A user's or group's default calendar.
PATCH /me/calendar
PATCH /users/{id | userPrincipalName}/calendar
PATCH /groups/{id}/calendar
A user's calendar in the default calendarGroup.
PATCH /me/calendars/{id}
PATCH /users/{id | userPrincipalName}/calendars/{id}
A user's calendar in a specific calendarGroup.
PATCH /me/calendarGroups/{id}/calendars/{id}
PATCH /users/{id | userPrincipalName}/calendarGroups/{id}/calendars/{id}
Request headers
Header | Value |
---|---|
Authorization | Bearer {token}. Required. Learn more about authentication and authorization. |
Content-Type | application/json. Required. |
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 |
---|---|---|
color | String | Specifies the color theme to distinguish the calendar from other calendars in a UI. The property values are: LightBlue=0, LightGreen=1, LightOrange=2, LightGray=3, LightYellow=4, LightTeal=5, LightPink=6, LightBrown=7, LightRed=8, MaxColor=9, Auto=-1 |
isDefaultCalendar | Boolean | True if this calendar is the user's default calendar, false otherwise. |
name | String | The calendar name. |
Response
If successful, this method returns a 200 OK
response code and updated calendar object in the response body.
Example
Request
The following example updates the name of the signed-in user's default calendar.
PATCH https://graph.microsoft.com/v1.0/me/calendar
Content-type: application/json
{
"name": "Social events"
}
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
{
"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#me/calendars/$entity",
"@odata.id":"https://graph.microsoft.com/v1.0/users('266efe5a-0fd7-4edd-877b-b2d1e561f193@ae01a323-3934-4475-a32d-af1274312bb0')/calendars('AAMkADJmMVAAA=')",
"id":"AAMkADJmMVAAA=",
"name":"Social events",
"color":"auto",
"isDefaultCalendar":false,
"changeKey":"DxYSthXJXEWwAQSYQnXvIgAAIxGttg==",
"canShare":true,
"canViewPrivateItems":true,
"hexColor": "",
"canEdit":true,
"allowedOnlineMeetingProviders": [
"teamsForBusiness"
],
"defaultOnlineMeetingProvider": "teamsForBusiness",
"isTallyingResponses": true,
"isRemovable": false,
"owner":{
"name":"Samantha Booth",
"address":"[email protected]"
}
}