Create CalendarGroup
8/15/2019
2 minutes to read
In this article
Important
APIs under the /beta
version in Microsoft Graph are subject to change. Use of these APIs in production applications is not supported.
Use this API to create a new CalendarGroup.
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
POST /me/calendarGroups
POST /users/{id | userPrincipalName}/calendarGroups
Header
Value
Authorization
Bearer {token}. Required.
Content-Type
application/json
Request body
In the request body, supply a JSON representation of CalendarGroup object.
Response
If successful, this method returns 201 Created
response code and CalendarGroup object in the response body.
Example
Request
Here is an example of the request.
POST https://graph.microsoft.com/beta/me/calendarGroups
Content-type: application/json
Content-length: 90
{
"name": "name-value",
"classId": "classId-value",
"changeKey": "changeKey-value"
}
GraphServiceClient graphClient = new GraphServiceClient( authProvider );
var calendarGroup = new CalendarGroup
{
Name = "name-value",
ClassId = Guid.Parse("classId-value"),
ChangeKey = "changeKey-value"
};
await graphClient.Me.CalendarGroups
.Request()
.AddAsync(calendarGroup);
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
const options = {
authProvider,
};
const client = Client.init(options);
const calendarGroup = {
name: "name-value",
classId: "classId-value",
changeKey: "changeKey-value"
};
let res = await client.api('/me/calendarGroups')
.version('beta')
.post(calendarGroup);
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
MSHTTPClient *httpClient = [MSClientFactory createHTTPClientWithAuthenticationProvider:authenticationProvider];
NSString *MSGraphBaseURL = @"https://graph.microsoft.com/beta/";
NSMutableURLRequest *urlRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:[MSGraphBaseURL stringByAppendingString:@"/me/calendarGroups"]]];
[urlRequest setHTTPMethod:@"POST"];
[urlRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
MSGraphCalendarGroup *calendarGroup = [[MSGraphCalendarGroup alloc] init];
[calendarGroup setName:@"name-value"];
[calendarGroup setClassId:@"classId-value"];
[calendarGroup setChangeKey:@"changeKey-value"];
NSError *error;
NSData *calendarGroupData = [calendarGroup getSerializedDataWithError:&error];
[urlRequest setHTTPBody:calendarGroupData];
MSURLSessionDataTask *meDataTask = [httpClient dataTaskWithRequest:urlRequest
completionHandler: ^(NSData *data, NSURLResponse *response, NSError *nserror) {
//Request Completed
}];
[meDataTask execute];
Read the SDK documentation for details on how to add the SDK to your project and create an authProvider instance.
In the request body, supply a JSON representation of calendarGroup object.
Response
Here is an example of the response. Note: The response object shown here may be truncated for brevity. All of the properties will be returned from an actual call.
HTTP/1.1 201 Created
Content-type: application/json
Content-length: 110
{
"name": "name-value",
"classId": "classId-value",
"changeKey": "changeKey-value",
"id": "id-value"
}