名前空間: microsoft.graph
重要
Microsoft Graph の /beta
バージョンの API は変更される可能性があります。 実稼働アプリケーションでこれらの API を使用することは、サポートされていません。 v1.0 で API を使用できるかどうかを確認するには、Version セレクターを使用します。
ユーザー用の新しい予定表を作成します。
この API は、次の国内クラウド展開で使用できます。
グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
✅ |
✅ |
✅ |
✅ |
アクセス許可
この API を呼び出すには、次のいずれかのアクセス許可が必要です。 アクセス許可の選択方法などの詳細については、「アクセス許可」を参照してください。
アクセス許可の種類 |
アクセス許可 (特権の小さいものから大きいものへ) |
委任 (職場または学校のアカウント) |
Calendars.ReadWrite |
委任 (個人用 Microsoft アカウント) |
Calendars.ReadWrite |
アプリケーション |
Calendars.ReadWrite |
HTTP 要求
POST /me/calendars
POST /users/{id | userPrincipalName}/calendars
ヘッダー |
値 |
Authorization |
ベアラー {token}。 必須です。
認証と承認の詳細については、こちらをご覧ください。 |
Content-Type |
application/json |
要求本文
要求本文で、予定表オブジェクトの JSON 表記を指定します。
応答
成功した場合、このメソッドは応答本文で 201 Created
応答コードと予定表オブジェクトを返します。
例
要求
次の例は要求を示しています。
POST https://graph.microsoft.com/beta/me/calendars
Content-type: application/json
{
"name": "Volunteer"
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Beta.Models;
var requestBody = new Calendar
{
Name = "Volunteer",
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.Calendars.PostAsync(requestBody);
mgc-beta users calendars create --user-id {user-id} --body '{\
"name": "Volunteer"\
}\
\
'
// Code snippets are only available for the latest major version. Current major version is $v0.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-beta-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-beta-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewCalendar()
name := "Volunteer"
requestBody.SetName(&name)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
calendars, err := graphClient.Me().Calendars().Post(context.Background(), requestBody, nil)
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
Calendar calendar = new Calendar();
calendar.setName("Volunteer");
Calendar result = graphClient.me().calendars().post(calendar);
const options = {
authProvider,
};
const client = Client.init(options);
const calendar = {
name: 'Volunteer'
};
await client.api('/me/calendars')
.version('beta')
.post(calendar);
<?php
use Microsoft\Graph\Beta\GraphServiceClient;
use Microsoft\Graph\Beta\Generated\Models\Calendar;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new Calendar();
$requestBody->setName('Volunteer');
$result = $graphServiceClient->me()->calendars()->post($requestBody)->wait();
Import-Module Microsoft.Graph.Beta.Calendar
$params = @{
name = "Volunteer"
}
# A UPN can also be used as -UserId.
New-MgBetaUserCalendar -UserId $userId -BodyParameter $params
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph_beta import GraphServiceClient
from msgraph_beta.generated.models.calendar import Calendar
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = Calendar(
name = "Volunteer",
)
result = await graph_client.me.calendars.post(request_body)
応答
次の例は応答を示しています。
注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 201 Created
Content-type: application/json
{
"@odata.context":"https://graph.microsoft.com/beta/$metadata#me/calendars/$entity",
"@odata.id":"https://graph.microsoft.com/beta/users('266efe5a-0fd7-4edd-877b-b2d1e561f193@ae01a323-3934-4475-a32d-af1274312bb0')/calendars('AAMkADJmMVAAA=')",
"id":"AAMkADJmMVAAA=",
"name":"Volunteer",
"color":"auto",
"isDefaultCalendar":false,
"changeKey":"DxYSthXJXEWwAQSYQnXvIgAAIxGttg==",
"calendarGroupId":null,
"canShare":true,
"canViewPrivateItems":true,
"hexColor": "",
"isShared":false,
"isSharedWithMe":false,
"canEdit":true,
"allowedOnlineMeetingProviders": [
"teamsForBusiness"
],
"defaultOnlineMeetingProvider": "teamsForBusiness",
"isTallyingResponses": true,
"isRemovable": false,
"owner":{
"name":"Samantha Booth",
"address":"samanthab@contoso.com"
}
}