msgraph-sdk-php icon indicating copy to clipboard operation
msgraph-sdk-php copied to clipboard

Creating an OnlineMeeting for an organizer without TollFree Numbers causes Kiota deserialization error

Open jamesgraham opened this issue 2 months ago • 3 comments

Describe the bug

I am creating Online Meetings for users. For some users, this works fine. For others it does not.

Basic details are passed to create the meeting, and I need the OnlineMeeting body back to pull data.

It appears that when hydrating the models, the serialiser blows up at AudioConferencing. You will see this in the stack trace.

Expected behavior

It creates the meeting and returns the response

How to reproduce

Create a meeting with a user that has no Audio Conferencing Policy attached

SDK Version

2.49

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output

Click to expand log ```

{"error":"Collection of type=string contains value of type=null","extractedError":"Collection of type=string contains value of type=null","userId":"5a9c723f-e3a6-43fb-92b2-104d65409585","exception":"UnexpectedValueException","file":"/home/jiminny/vendor/microsoft/kiota-abstractions/src/Types/TypeUtils.php","line":33,"trace":"#0 /home/jiminny/vendor/microsoft/microsoft-graph/src/Generated/Models/AudioConferencing.php(97): Microsoft\Kiota\Abstractions\Types\TypeUtils::validateCollectionValues(Array, 'string') #1 /home/jiminny/vendor/microsoft/kiota-serialization-json/src/JsonParseNode.php(147): Microsoft\Graph\Generated\Models\AudioConferencing->Microsoft\Graph\Generated\Models\{closure}(Object(Microsoft\Kiota\Serialization\Json\JsonParseNode)) #2 /home/jiminny/vendor/microsoft/kiota-serialization-json/src/JsonParseNode.php(120): Microsoft\Kiota\Serialization\Json\JsonParseNode->assignFieldValues(Object(Microsoft\Graph\Generated\Models\AudioConferencing)) #3 /home/jiminny/vendor/microsoft/microsoft-graph/src/Generated/Models/OnlineMeetingBase.php(276): Microsoft\Kiota\Serialization\Json\JsonParseNode->getObjectValue(Array) #4 /home/jiminny/vendor/microsoft/kiota-serialization-json/src/JsonParseNode.php(147): Microsoft\Graph\Generated\Models\OnlineMeetingBase->Microsoft\Graph\Generated\Models\{closure}(Object(Microsoft\Kiota\Serialization\Json\JsonParseNode)) #5 /home/jiminny/vendor/microsoft/kiota-serialization-json/src/JsonParseNode.php(120): Microsoft\Kiota\Serialization\Json\JsonParseNode->assignFieldValues(Object(Microsoft\Graph\Generated\Models\OnlineMeeting)) #6 /home/jiminny/vendor/microsoft/kiota-http-guzzle/src/GuzzleRequestAdapter.php(170): Microsoft\Kiota\Serialization\Json\JsonParseNode->getObjectValue(Array) #7 /home/jiminny/vendor/php-http/promise/src/FulfilledPromise.php(39): Microsoft\Kiota\Http\GuzzleRequestAdapter->Microsoft\Kiota\Http\{closure}(Object(GuzzleHttp\Psr7\Response)) #8 /home/jiminny/vendor/microsoft/kiota-http-guzzle/src/GuzzleRequestAdapter.php(145): Http\Promise\FulfilledPromise->then(Object(Closure)) #9 /home/jiminny/vendor/microsoft/microsoft-graph/src/Generated/Users/Item/OnlineMeetings/CreateOrGet/CreateOrGetRequestBuilder.php(46): Microsoft\Kiota\Http\GuzzleRequestAdapter->sendAsync(Object(Microsoft\Kiota\Abstractions\RequestInformation), Array, Array)

</details>


### Configuration

_No response_

### Other information

_No response_

jamesgraham avatar Oct 14 '25 13:10 jamesgraham

This code is responsible:

'tollFreeNumbers' => function (ParseNode $n) {
    $val = $n->getCollectionOfPrimitiveValues();
    if (is_array($val)) {
        TypeUtils::validateCollectionValues($val, 'string');
    }
    /** @var array<string>|null $val */
    $this->setTollFreeNumbers($val);
},

$val is an array with a null value:

array(1) {
  [0]=>
  NULL
}

jamesgraham avatar Oct 14 '25 14:10 jamesgraham

@jamesgraham ran into this exact same issue after updating from the v1 sdk to v2.

Create a meeting with a user that has no Audio Conferencing Policy attached

Was your resolution to get your clients to setup the audio conferencing policy?

I'm thinking of making a fork to just filter out the null values until this is resolved. Just something like $val = array_values(array_filter($val)); after the if (is_array($val)) { check.

warrenspence avatar Nov 24 '25 22:11 warrenspence

We can't get every tenant to setup Audio so we just overrode the class and tweaked it as you suggest. Composer overrides take care of it but not very clean.

jamesgraham avatar Nov 25 '25 13:11 jamesgraham