When updating the preferred date or time format for a user, specify it in respectively, the short date or short time format.
When updating the preferred time zone for a user, specify it in the Windows or Internet Assigned Numbers Authority (IANA) time zone (also known as Olson time zone) format. You can also further customize the time zone as shown in example 2 below.
Tip
You cannot create or delete any mailbox settings.
Permissions
One of the following permissions is required to call this API. To learn more, including how to choose permissions, see Permissions.
In the request body, supply the values for the relevant properties 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. The following are the writable/updatable properties:
Configuration settings to automatically notify the sender of an incoming email with a message from the signed-in user. You can set such notifications for only a future date range.
dateFormat
string
The date format for the user's mailbox.
delegateMeetingMessageDeliveryOptions
delegateMeetingMessageDeliveryOptions
If the user has a calendar delegate, this specifies whether the delegate, mailbox owner, or both receive meeting messages and meeting responses. Possible values are: sendToDelegateAndInformationToPrincipal, sendToDelegateAndPrincipal, sendToDelegateOnly.
The hours, days of a week, and time zone that the user works.
Response
If successful, this method returns a 200 OK response code and the updated properties of a mailboxSettings object in the response body.
Errors
Setting working hours with inappropriate values may return the following errors.
Scenario
HTTP status code
Error code
Error message
Invalid startTime or endTime
400
RequestBodyRead
Cannot convert the literal '08' to the expected type 'Edm.TimeOfDay'.
Start time is greater than end time
400
ErrorInvalidTimeSettings
Start Time should occur before End Time.
Invalid day in daysOfWeek
400
InvalidArguments
Requested value 'RandomDay' was not found.
Invalid timeZone
400
InvalidTimeZone
Time Zone settings provided are invalid.
Examples
Example 1
Request
The first example enables automatic replies for a date range, by setting the following properties of the automaticRepliesSetting property:
status, scheduledStartDateTime and scheduledEndDateTime.
// Code snippets are only available for the latest version. Current version is 5.x
var graphClient = new GraphServiceClient(requestAdapter);
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"
},
},
};
var result = await graphClient.Me.MailboxSettings.PatchAsync(requestBody);
<?php
// THIS SNIPPET IS A PREVIEW FOR THE KIOTA BASED SDK. NON-PRODUCTION USE ONLY
$graphServiceClient = new GraphServiceClient($requestAdapter);
$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);
The response includes the updated settings for automatic replies. 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/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"
}
}
Example 2
Request
The second example customizes the time zone for the working hours of the signed-in user, by setting the timeZone property
to a custom time zone.