microsoftgraph / msgraph-sdk-php

Microsoft Graph Library for PHP.
Other
568 stars 144 forks source link

Problem calling PATCH on an OnlineMeeting #1484

Closed gkotsinos closed 6 months ago

gkotsinos commented 6 months ago

Hello,

as stated, I am trying to patch an Microsoft\Graph\Generated\Models\OnlineMeeting model. The error I am getting is that I am sending a property that isn't allowed to get PATCHed. After some debugging I figured out that although during the instantiation of my OnlineMeeting object I am only filling the attendees property, the body of the request ends up being this:

{"@odata.type":"#microsoft.graph.onlineMeeting","attendeeReport":null,"participants":{"attendees":[{"upn":"user@somedomain.com"}]}}

From what I understand the attendeeReport property should not end up in the request body since I am not setting it, and I have confirmed that is the issue since sending the same request without the property works fine.

Also as defined in the relevant documentation this property is not even in the list of options that are updateable ( https://learn.microsoft.com/en-us/graph/api/onlinemeeting-update?view=graph-rest-1.0&tabs=http#request-body )

EDIT: I can successfully solve the issue with this simplistic approach confirming the issue:

Within Microsoft\Graph\Generated\Models\OnlineMeeting

change this line:

$writer->writeBinaryContent('attendeeReport', $this->getAttendeeReport());

to this line: if (!empty($this->getAttendeeReport())) { $writer->writeBinaryContent('attendeeReport', $this->getAttendeeReport()); }

SilasKenneth commented 6 months ago

Hi @gkotsinos ,thank you for trying out the SDK, I am currently looking into the issue. In the meantime, could you please provide the version of the SDK you are using and the code you are trying to run(if possible).

gkotsinos commented 6 months ago

Hi @gkotsinos ,thank you for trying out the SDK, I am currently looking into the issue. In the meantime, could you please provide the version of the SDK you are using and the code you are trying to run(if possible).

Hi, thanks for the quick response! I can't share the exact code but you should be able to easilly reproduce it. Working on an existing OnlineMeeting:

$onlineMeeting = new OnlineMeeting();
$meetingParticipants = new MeetingParticipants();
$attendees = [];
$attendee = new MeetingParticipantInfo();
$attendee->setUpn('some-valid@mail.com')
$attendees[] = $attendee;
$meetingParticipants->setAttendees($attendees);
$onlineMeeting->setParticipants($meetingParticipants);

try {
  $response = $this->graphClient->users()->byUserId($userId)->onlineMeetings()->byOnlineMeetingId($eventId)->patch($onlineMeeting)->wait();
}
catch (Throwable $ex) {
}

this should be enough to catch it. Just FYI, I haven't run this code it might have issues!

I edited my initial comment with a simple solution that kinda highlights the issue as well.

gkotsinos commented 6 months ago

Hi @gkotsinos ,thank you for trying out the SDK, I am currently looking into the issue. In the meantime, could you please provide the version of the SDK you are using and the code you are trying to run(if possible).

Hello, forgot to mention, I' m using the latest version of the SDK, Release 2.3.0

SilasKenneth commented 6 months ago

Hi @gkotsinos, thanks for providing additional information. I am able to reproduce the issue. I am putting this as high priority so we get it fixed ASAP. Sorry for the inconvenience.

SilasKenneth commented 6 months ago

Hi @gkotsinos ,the issue is now resolved. Please run composer update to update to the latest version of the serialization library. Please feel free to re-open the issue if you're still facing the issue.