名前空間: microsoft.graph
ユーザーの mailboxSettings の一部として、次の 1 つ以上の設定を有効、構成、または無効にします。
-
自動応答 (メールの受信時にユーザーに自動的に通知)
- dateFormat
- delegateMeetingMessageDeliveryOptions
-
ロケール (言語および国/地域)
- timeFormat
- タイム ゾーン
-
稼働時間
ユーザーの優先する日付または時刻の形式を更新する場合は、それぞれ 短い日付 または 短い時刻 形式で指定します。
ユーザーの優先タイム ゾーンを更新する場合は、Windows または インターネット割り当て番号機関 (IANA) タイム ゾーン ( オルソン タイム ゾーンとも呼ばれます) 形式で指定します。 次の 例 2 に示すように、タイム ゾーンをさらにカスタマイズすることもできます。
ヒント
メールボックス設定を作成または削除することはできません。
この API は、次の国内クラウド展開で使用できます。
| グローバル サービス |
米国政府機関 L4 |
米国政府機関 L5 (DOD) |
21Vianet が運営する中国 |
| ✅ |
✅ |
✅ |
✅ |
アクセス許可
この API の最小特権としてマークされているアクセス許可またはアクセス許可を選択します。
アプリで必要な場合にのみ、より高い特権のアクセス許可またはアクセス許可を使用します。 委任されたアクセス許可とアプリケーションのアクセス許可の詳細については、「アクセス許可の種類」を参照してください。 これらのアクセス許可の詳細については、「アクセス許可のリファレンス」を参照してください。
| アクセス許可の種類 |
最小特権アクセス許可 |
より高い特権のアクセス許可 |
| 委任 (職場または学校のアカウント) |
MailboxSettings.ReadWrite |
注意事項なし。 |
| 委任 (個人用 Microsoft アカウント) |
MailboxSettings.ReadWrite |
注意事項なし。 |
| アプリケーション |
MailboxSettings.ReadWrite |
注意事項なし。 |
HTTP 要求
PATCH /me/mailboxSettings
PATCH /users/{id|userPrincipalName}/mailboxSettings
オプションのクエリ パラメーター
このメソッドは、応答をカスタマイズするための OData クエリ パラメーターをサポートします。
| 名前 |
型 |
説明 |
| Authorization |
string |
ベアラー {token}。 必須です。
認証と認可についての詳細をご覧ください。 |
要求本文
要求本文で、更新する関連プロパティの値を指定します。 要求本文に含まれない既存のプロパティは、以前の値のままになるか、他のプロパティ値の変化に基づいて再計算されます。 最適なパフォーマンスを得るためには、変更されていない既存の値を含めないでください。 書き込み可能または更新可能なプロパティを次に示します。
| プロパティ |
型 |
説明 |
| automaticRepliesSetting |
automaticRepliesSetting |
サインイン ユーザーからのメッセージを使用して、着信メールの送信者に自動的に通知する構成設定。 このような通知は、将来の日付範囲にのみ設定できます。 |
| dateFormat |
string |
ユーザーのメールボックスの日付形式。 |
| delegateMeetingMessageDeliveryOptions |
delegateMeetingMessageDeliveryOptions |
ユーザーが予定表代理人を持っている場合は、代理人、メールボックス所有者、またはその両方が会議メッセージと会議の応答を受信するかどうかを指定します。 可能な値は sendToDelegateAndInformationToPrincipal、sendToDelegateAndPrincipal、sendToDelegateOnly です。 |
| language |
localeInfo |
優先言語および国/地域を含むユーザーのロケール情報。 |
| timeFormat |
string |
ユーザーのメールボックスの時刻形式。 |
| timeZone |
string |
ユーザーのメールボックスの既定のタイム ゾーン。 |
| workingHours |
workingHours |
ユーザーが働く時間、曜日、タイムゾーン。 |
応答
成功した場合、このメソッドは 200 OK 応答コードと、応答本文の mailboxSettings オブジェクトの更新されたプロパティを返します。
エラー
不適切な値で就労時間を設定すると、次のエラーが返されます。
| シナリオ |
HTTP ステータス コード |
エラー コード |
エラー メッセージ |
| 無効な startTime または endTime |
400 |
RequestBodyRead |
リテラル '08' を期待される型 'Edm.TimeOfDay' に変換できません。 |
| 終了時刻の後に設定されている開始時刻 |
400 |
ErrorInvalidTimeSettings |
開始時刻は、終了時刻の前でなければなりません。 |
|
daysOfWeek に設定された無効な曜日 |
400 |
InvalidArguments |
要求された値 'RandomDay' が見つかりませんでした。 |
| 無効な timeZone |
400 |
InvalidTimeZone |
指定されているタイム ゾーンの設定は無効です。 |
例
例 1
要求
最初の例では、automaticRepliesSetting プロパティの status、scheduledStartDateTime および scheduledEndDateTime プロパティを設定して、該当する日付範囲に対して自動応答を有効にします。
PATCH https://graph.microsoft.com/v1.0/me/mailboxSettings
Content-Type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Me/mailboxSettings",
"automaticRepliesSetting": {
"status": "Scheduled",
"scheduledStartDateTime": {
"dateTime": "2016-03-20T18:00:00.0000000",
"timeZone": "UTC"
},
"scheduledEndDateTime": {
"dateTime": "2016-03-28T18:00:00.0000000",
"timeZone": "UTC"
}
}
}
// Code snippets are only available for the latest version. Current version is 5.x
// Dependencies
using Microsoft.Graph.Models;
var requestBody = new MailboxSettings
{
AutomaticRepliesSetting = new AutomaticRepliesSetting
{
Status = AutomaticRepliesStatus.Scheduled,
ScheduledStartDateTime = new DateTimeTimeZone
{
DateTime = "2016-03-20T18:00:00.0000000",
TimeZone = "UTC",
},
ScheduledEndDateTime = new DateTimeTimeZone
{
DateTime = "2016-03-28T18:00:00.0000000",
TimeZone = "UTC",
},
},
AdditionalData = new Dictionary<string, object>
{
{
"@odata.context" , "https://graph.microsoft.com/v1.0/$metadata#Me/mailboxSettings"
},
},
};
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=csharp
var result = await graphClient.Me.MailboxSettings.PatchAsync(requestBody);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
// Code snippets are only available for the latest major version. Current major version is $v1.*
// Dependencies
import (
"context"
msgraphsdk "github.com/microsoftgraph/msgraph-sdk-go"
graphmodels "github.com/microsoftgraph/msgraph-sdk-go/models"
//other-imports
)
requestBody := graphmodels.NewMailboxSettings()
automaticRepliesSetting := graphmodels.NewAutomaticRepliesSetting()
status := graphmodels.SCHEDULED_AUTOMATICREPLIESSTATUS
automaticRepliesSetting.SetStatus(&status)
scheduledStartDateTime := graphmodels.NewDateTimeTimeZone()
dateTime := "2016-03-20T18:00:00.0000000"
scheduledStartDateTime.SetDateTime(&dateTime)
timeZone := "UTC"
scheduledStartDateTime.SetTimeZone(&timeZone)
automaticRepliesSetting.SetScheduledStartDateTime(scheduledStartDateTime)
scheduledEndDateTime := graphmodels.NewDateTimeTimeZone()
dateTime := "2016-03-28T18:00:00.0000000"
scheduledEndDateTime.SetDateTime(&dateTime)
timeZone := "UTC"
scheduledEndDateTime.SetTimeZone(&timeZone)
automaticRepliesSetting.SetScheduledEndDateTime(scheduledEndDateTime)
requestBody.SetAutomaticRepliesSetting(automaticRepliesSetting)
additionalData := map[string]interface{}{
"@odata.context" : "https://graph.microsoft.com/v1.0/$metadata#Me/mailboxSettings",
}
requestBody.SetAdditionalData(additionalData)
// To initialize your graphClient, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=go
mailboxSettings, err := graphClient.Me().MailboxSettings().Patch(context.Background(), requestBody, nil)
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
// Code snippets are only available for the latest version. Current version is 6.x
GraphServiceClient graphClient = new GraphServiceClient(requestAdapter);
MailboxSettings mailboxSettings = new MailboxSettings();
AutomaticRepliesSetting automaticRepliesSetting = new AutomaticRepliesSetting();
automaticRepliesSetting.setStatus(AutomaticRepliesStatus.Scheduled);
DateTimeTimeZone scheduledStartDateTime = new DateTimeTimeZone();
scheduledStartDateTime.setDateTime("2016-03-20T18:00:00.0000000");
scheduledStartDateTime.setTimeZone("UTC");
automaticRepliesSetting.setScheduledStartDateTime(scheduledStartDateTime);
DateTimeTimeZone scheduledEndDateTime = new DateTimeTimeZone();
scheduledEndDateTime.setDateTime("2016-03-28T18:00:00.0000000");
scheduledEndDateTime.setTimeZone("UTC");
automaticRepliesSetting.setScheduledEndDateTime(scheduledEndDateTime);
mailboxSettings.setAutomaticRepliesSetting(automaticRepliesSetting);
HashMap<String, Object> additionalData = new HashMap<String, Object>();
additionalData.put("@odata.context", "https://graph.microsoft.com/v1.0/$metadata#Me/mailboxSettings");
mailboxSettings.setAdditionalData(additionalData);
MailboxSettings result = graphClient.me().mailboxSettings().patch(mailboxSettings);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
const options = {
authProvider,
};
const client = Client.init(options);
const mailboxSettings = {
'@odata.context': 'https://graph.microsoft.com/v1.0/$metadata#Me/mailboxSettings',
automaticRepliesSetting: {
status: 'Scheduled',
scheduledStartDateTime: {
dateTime: '2016-03-20T18:00:00.0000000',
timeZone: 'UTC'
},
scheduledEndDateTime: {
dateTime: '2016-03-28T18:00:00.0000000',
timeZone: 'UTC'
}
}
};
await client.api('/me/mailboxSettings')
.update(mailboxSettings);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
<?php
use Microsoft\Graph\GraphServiceClient;
use Microsoft\Graph\Generated\Models\MailboxSettings;
use Microsoft\Graph\Generated\Models\AutomaticRepliesSetting;
use Microsoft\Graph\Generated\Models\AutomaticRepliesStatus;
use Microsoft\Graph\Generated\Models\DateTimeTimeZone;
$graphServiceClient = new GraphServiceClient($tokenRequestContext, $scopes);
$requestBody = new MailboxSettings();
$automaticRepliesSetting = new AutomaticRepliesSetting();
$automaticRepliesSetting->setStatus(new AutomaticRepliesStatus('scheduled'));
$automaticRepliesSettingScheduledStartDateTime = new DateTimeTimeZone();
$automaticRepliesSettingScheduledStartDateTime->setDateTime('2016-03-20T18:00:00.0000000');
$automaticRepliesSettingScheduledStartDateTime->setTimeZone('UTC');
$automaticRepliesSetting->setScheduledStartDateTime($automaticRepliesSettingScheduledStartDateTime);
$automaticRepliesSettingScheduledEndDateTime = new DateTimeTimeZone();
$automaticRepliesSettingScheduledEndDateTime->setDateTime('2016-03-28T18:00:00.0000000');
$automaticRepliesSettingScheduledEndDateTime->setTimeZone('UTC');
$automaticRepliesSetting->setScheduledEndDateTime($automaticRepliesSettingScheduledEndDateTime);
$requestBody->setAutomaticRepliesSetting($automaticRepliesSetting);
$additionalData = [
'@odata.context' => 'https://graph.microsoft.com/v1.0/$metadata#Me/mailboxSettings',
];
$requestBody->setAdditionalData($additionalData);
$result = $graphServiceClient->me()->mailboxSettings()->patch($requestBody)->wait();
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
Import-Module Microsoft.Graph.Users
$params = @{
"@odata.context" = "https://graph.microsoft.com/v1.0/$metadata#Me/mailboxSettings"
automaticRepliesSetting = @{
status = "Scheduled"
scheduledStartDateTime = @{
dateTime = "2016-03-20T18:00:00.0000000"
timeZone = "UTC"
}
scheduledEndDateTime = @{
dateTime = "2016-03-28T18:00:00.0000000"
timeZone = "UTC"
}
}
}
# A UPN can also be used as -UserId.
Update-MgUserMailboxSetting -UserId $userId -BodyParameter $params
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
# Code snippets are only available for the latest version. Current version is 1.x
from msgraph import GraphServiceClient
from msgraph.generated.models.mailbox_settings import MailboxSettings
from msgraph.generated.models.automatic_replies_setting import AutomaticRepliesSetting
from msgraph.generated.models.automatic_replies_status import AutomaticRepliesStatus
from msgraph.generated.models.date_time_time_zone import DateTimeTimeZone
# To initialize your graph_client, see https://learn.microsoft.com/en-us/graph/sdks/create-client?from=snippets&tabs=python
request_body = MailboxSettings(
automatic_replies_setting = AutomaticRepliesSetting(
status = AutomaticRepliesStatus.Scheduled,
scheduled_start_date_time = DateTimeTimeZone(
date_time = "2016-03-20T18:00:00.0000000",
time_zone = "UTC",
),
scheduled_end_date_time = DateTimeTimeZone(
date_time = "2016-03-28T18:00:00.0000000",
time_zone = "UTC",
),
),
additional_data = {
"@odata_context" : "https://graph.microsoft.com/v1.0/$metadata#Me/mailboxSettings",
}
)
result = await graph_client.me.mailbox_settings.patch(request_body)
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
応答
この応答には、自動応答の設定が含まれます。 注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#Me/mailboxSettings",
"automaticRepliesSetting": {
"status": "scheduled",
"externalAudience": "all",
"scheduledStartDateTime": {
"dateTime": "2016-03-20T02:00:00.0000000",
"timeZone": "UTC"
},
"scheduledEndDateTime": {
"dateTime": "2016-03-28T02:00:00.0000000",
"timeZone": "UTC"
},
"internalReplyMessage": "<html>\n<body>\n<p>I'm at our company's worldwide reunion and will respond to your message as soon as I return.<br>\n</p></body>\n</html>\n",
"externalReplyMessage": "<html>\n<body>\n<p>I'm at the Contoso worldwide reunion and will respond to your message as soon as I return.<br>\n</p></body>\n</html>\n"
}
}
例 2
要求
2 番目の例では、サインインしているユーザーの就業時間のタイム ゾーンをカスタマイズするために、timeZone プロパティをカスタム タイム ゾーンに設定します。
PATCH https://graph.microsoft.com/v1.0/me/mailboxSettings
Content-Type: application/json
{
"workingHours": {
"endTime" : "18:30:00.0000000",
"daysOfWeek": [
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
],
"timeZone" : {
"@odata.type": "#microsoft.graph.customTimeZone",
"bias":-300,
"name": "Customized Time Zone",
"standardOffset":{
"time":"02:00:00.0000000",
"dayOccurrence":2,
"dayOfWeek":"Sunday",
"month":10,
"year":0
},
"daylightOffset":{
"daylightBias":100,
"time":"02:00:00.0000000",
"dayOccurrence":4,
"dayOfWeek":"Sunday",
"month":5,
"year":0
}
}
}
}
const options = {
authProvider,
};
const client = Client.init(options);
const mailboxSettings = {
workingHours: {
endTime: '18:30:00.0000000',
daysOfWeek: [
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday'
],
timeZone: {
'@odata.type': '#microsoft.graph.customTimeZone',
bias: -300,
name: 'Customized Time Zone',
standardOffset: {
time: '02:00:00.0000000',
dayOccurrence: 2,
dayOfWeek: 'Sunday',
month: 10,
year: 0
},
daylightOffset: {
daylightBias: 100,
time: '02:00:00.0000000',
dayOccurrence: 4,
dayOfWeek: 'Sunday',
month: 5,
year: 0
}
}
}
};
await client.api('/me/mailboxSettings')
.update(mailboxSettings);
プロジェクトに SDK を追加し、authProvider インスタンスを作成する方法の詳細については、SDK のドキュメントを参照してください。
応答
次の例は応答を示しています。 注: ここに示す応答オブジェクトは、読みやすさのために短縮されている場合があります。
HTTP/1.1 200 OK
Content-type: application/json
{
"@odata.context":"https://graph.microsoft.com/v1.0/$metadata#users('94447c6e-ea4c-494c-a9ed-d905e366c5cb')/mailboxSettings",
"workingHours":{
"daysOfWeek":[
"monday",
"tuesday",
"wednesday",
"thursday",
"friday",
"saturday"
],
"startTime":"09:00:00.0000000",
"endTime":"18:30:00.0000000",
"timeZone":{
"@odata.type":"#microsoft.graph.customTimeZone",
"bias":-200,
"name":"Customized Time Zone",
"standardOffset":{
"time":"02:00:00.0000000",
"dayOccurrence":4,
"dayOfWeek":"sunday",
"month":5,
"year":0
},
"daylightOffset":{
"daylightBias":-100,
"time":"02:00:00.0000000",
"dayOccurrence":2,
"dayOfWeek":"sunday",
"month":10,
"year":0
}
}
}
}