Create a calendarPermission resource to specify the identity and role of the user with whom the specified calendar is being shared or delegated.
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.Read, Calendars.ReadWrite
Calendars.Read, Calendars.ReadWrite
Calendars.Read, Calendars.ReadWrite
group calendar
Group.Read.All, Group.ReadWrite.All
Not supported.
Not supported.
HTTP request
Create the specified permissions of a user's primary calendar:
POST /users/{id}/calendar/calendarPermissions
Create the specified permissions of a group calendar:
POST /groups/{id}/calendar/calendarPermissions
Create the specified permissions of the user calendar that contains the identified event:
POST /users/{id}/events/{id}/calendar/calendarPermissions
Request headers
Name
Description
Authorization
Bearer {token}. Required.
Content-Type
application/json. Required.
Request body
In the request body, supply a JSON representation of a calendarPermission object.
Response
If successful, this method returns a 200 OK response code and a collection of calendarPermission objects in the response body.
// Code snippets are only available for the latest version. Current version is 5.x
var graphClient = new GraphServiceClient(requestAdapter);
var requestBody = new CalendarPermission
{
EmailAddress = new EmailAddress
{
Name = "Samantha Booth",
Address = "samanthab@adatum.onmicrosoft.com",
},
IsInsideOrganization = true,
IsRemovable = true,
Role = CalendarRoleType.Read,
};
var result = await graphClient.Me.Calendar.CalendarPermissions.PostAsync(requestBody);
<?php
// THIS SNIPPET IS A PREVIEW VERSION OF THE SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new CalendarPermission();
$emailAddress = new EmailAddress();
$emailAddress->setName('Samantha Booth');
$emailAddress->setAddress('samanthab@adatum.onmicrosoft.com');
$requestBody->setEmailAddress($emailAddress);
$requestBody->setIsInsideOrganization(true);
$requestBody->setIsRemovable(true);
$requestBody->setRole(new CalendarRoleType('read'));
$result = $graphServiceClient->me()->calendar()->calendarPermissions()->post($requestBody)->wait();
# THE PYTHON SDK IS IN PREVIEW. FOR NON-PRODUCTION USE ONLY
graph_client = GraphServiceClient(request_adapter)
request_body = CalendarPermission(
email_address = EmailAddress(
name = "Samantha Booth",
address = "samanthab@adatum.onmicrosoft.com",
),
is_inside_organization = True,
is_removable = True,
role = CalendarRoleType.Read,
)
result = await graph_client.me.calendar.calendar_permissions.post(body = request_body)