Getting "Invalid enum value unknown" when trying to update mailboxSettings
Describe the bug
I am trying to update the mailboxSettings of a user via the following script
$mailboxSettings = new MailboxSettings();
$automaticRepliesSetting = new AutomaticRepliesSetting();
$automaticRepliesSetting->setStatus(new AutomaticRepliesStatus(AutomaticRepliesStatus::DISABLED));
$automaticRepliesSetting->setExternalAudience(new ExternalAudienceScope(ExternalAudienceScope::ALL));
$automaticRepliesSetting->setExternalReplyMessage("I am out of office with limited access to email.");
$automaticRepliesSetting->setInternalReplyMessage("I am out of office with limited access to email.");
$mailboxSettings->setAutomaticRepliesSetting($automaticRepliesSetting);
$response = $msGraph
->getClient()
->users()
->byUserId(<USERID>)
->mailboxSettings()
->patch($mailboxSettings)
->wait();
And I receive the following exception
Exception 'InvalidArgumentException' with message 'Invalid enum value unknown'
in /var/www/html/vendor/microsoft/kiota-abstractions/src/Enum.php:57
Stack trace:
#0 /var/www/html/vendor/microsoft/kiota-serialization-json/src/JsonParseNode.php(164): Microsoft\Kiota\Abstractions\Enum->__construct('unknown')
#1 /var/www/html/vendor/microsoft/microsoft-graph/src/Generated/Models/MailboxSettings.php(121): Microsoft\Kiota\Serialization\Json\JsonParseNode->getEnumValue('Microsoft\\Graph...')
#2 /var/www/html/vendor/microsoft/kiota-serialization-json/src/JsonParseNode.php(141): Microsoft\Graph\Generated\Models\MailboxSettings->Microsoft\Graph\Generated\Models\{closure}(Object(Microsoft\Kiota\Serialization\Json\JsonParseNode))
#3 /var/www/html/vendor/microsoft/kiota-serialization-json/src/JsonParseNode.php(114): Microsoft\Kiota\Serialization\Json\JsonParseNode->assignFieldValues(Object(Microsoft\Graph\Generated\Models\MailboxSettings))
#4 /var/www/html/vendor/microsoft/kiota-http-guzzle/src/GuzzleRequestAdapter.php(170): Microsoft\Kiota\Serialization\Json\JsonParseNode->getObjectValue(Array)
#5 /var/www/html/vendor/php-http/promise/src/FulfilledPromise.php(39): Microsoft\Kiota\Http\GuzzleRequestAdapter->Microsoft\Kiota\Http\{closure}(Object(GuzzleHttp\Psr7\Response))
#6 /var/www/html/vendor/microsoft/kiota-http-guzzle/src/GuzzleRequestAdapter.php(145): Http\Promise\FulfilledPromise->then(Object(Closure))
#7 /var/www/html/vendor/microsoft/microsoft-graph/src/Generated/Users/Item/MailboxSettings/MailboxSettingsRequestBuilder.php(59): Microsoft\Kiota\Http\GuzzleRequestAdapter->sendAsync(Object(Microsoft\Kiota\Abstractions\RequestInformation), Array, Array)
#8 /var/www/html/commands/OutOfOfficeController.php(99): Microsoft\Graph\Generated\Users\Item\MailboxSettings\MailboxSettingsRequestBuilder->patch(Object(Microsoft\Graph\Generated\Models\MailboxSettings))
MailboxSettings.php(121) -> points to UserPurpose which is a readonly value and shouldn't be set.
If a try to set it e.g.
$mailboxSettings->setUserPurpose(new UserPurpose(UserPurpose::ROOM));
I get the error, the property 'userPurpose' was specified but is not supported with this request.
Expected behavior
The request to succeed without having to call setSserPurpose property
How to reproduce
Execute the above script
SDK Version
2.12.0
Latest version known to work for scenario above?
No response
Known Workarounds
Use msgraph-sdk-php-core and execute the request manually ie
$httpClient = GraphClientFactory::createWithConfig($config);
$response = $httpClient->patch(
'/v1.0/users/<USER-ID>/mailboxSettings',
[
'json' => [
'automaticRepliesSetting' => [
"externalAudience"=> "all",
"status" => "disabled"
]
]
]
);
Debug output
Click to expand log
```</details>
### Configuration
PHP 8.3
### Other information
_No response_
@antoniom, thank you for raising this issue. After investigations, I found out that the service is returning an undefined/undocumented value (unkown) for the property userPurpose.
Based on the documentation here https://learn.microsoft.com/en-us/graph/api/resources/mailboxsettings?view=graph-rest-1.0#userpurpose-values, the value
unkown is not among the list of documented enums.
It is also not specified in the OpenAPI file used to generate this particular service in the SDK.
Unfortunately for API related issues/questions we are not best placed to give an answer. Kindly raise an issue here https://developer.microsoft.com/en-us/graph/support so that the API owner can respond to it.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.
This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.