microsoftgraph / microsoftgraph/msgraph-sdk-php
Getting "Invalid enum value unknown" when trying to update mailboxSettings
Offen
@timayabi2020 arbeitet bereits daran.
Seit 08.8.2024.
no-recent-activity
service bug
status:waiting-for-author-feedback
- Vorherrschende Sprache
- PHP
- Sterne
- 669
- Forks
- 150
- Ø Merge
- 15 Std. 21 Min.
- Gemergte PRs (30 T.)
- 3
Beschreibung
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_
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Bewertung
Dieses Issue wurde noch nicht bewertet.