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

Issue updating online meeting after upgrade to 6.6.0

Open ccea-dev-team opened this issue 1 year ago • 2 comments

I create an event with the online meeting flag set to true. Then I use the join url from this event to update it's backing online meeting to set a meeting co-organizer (this 2 step process seems to be the only way to set a co-organizer for an online meeting created from an event). This process worked fine in version 6.4.0 but after upgrading to 6.6.0 I get the following error when calling patch on the online meeting -

com.microsoft.graph.models.odataerrors.ODataError: Updating meeting type is not supported. at com.microsoft.graph.models.odataerrors.ODataError.createFromDiscriminatorValue(ODataError.java:36) ~[microsoft-graph-6.6.0.jar:na] at com.microsoft.kiota.serialization.JsonParseNode.getObjectValue(JsonParseNode.java:212) ~[microsoft-kiota-serialization-json-1.1.4.jar:na] at com.microsoft.kiota.http.OkHttpRequestAdapter.lambda$throwIfFailedResponse$0(OkHttpRequestAdapter.java:678) ~[microsoft-kiota-http-okHttp-1.1.4.jar:na] at com.microsoft.kiota.ApiExceptionBuilder.(ApiExceptionBuilder.java:26) ~[microsoft-kiota-abstractions-1.1.2.jar:na] at com.microsoft.kiota.http.OkHttpRequestAdapter.throwIfFailedResponse(OkHttpRequestAdapter.java:677) ~[microsoft-kiota-http-okHttp-1.1.4.jar:na] at com.microsoft.kiota.http.OkHttpRequestAdapter.send(OkHttpRequestAdapter.java:285) ~[microsoft-kiota-http-okHttp-1.1.4.jar:na]

Code that worked in version 6.4.0 below. Error happening in 6.6.0 when the patch is called on online meeting at the end-

public static Event createOnlineMeeting(String meetingOwnerEmail, String meetingName, Calendar meetingStartTime, Calendar     meetingEndTime, String meetingInviteBody, List<OnlineMeetingAttendee> attendees) throws Exception
{
	Event event = new Event();
	
	event.setSubject(meetingName);
	
	event.setBody(new ItemBody());
	
	event.getBody().setContentType(BodyType.Html);
	
	event.getBody().setContent(meetingInviteBody);
	
	event.setStart(new DateTimeTimeZone());
	
	event.getStart().setTimeZone(TIMEZONE);
	
	event.getStart().setDateTime(TIME_FORMAT.format(meetingStartTime.getTime()));
	
	event.setEnd(new DateTimeTimeZone());	
	
	event.getEnd().setTimeZone(TIMEZONE);
	
	event.getEnd().setDateTime(TIME_FORMAT.format(meetingEndTime.getTime()));
	
	event.setLocation(new Location());
	
	event.getLocation().setDisplayName("Online");
	
	event.setAllowNewTimeProposals(false);
	
	event.setIsOnlineMeeting(true);
	
	event.setOnlineMeetingProvider(OnlineMeetingProviderType.TeamsForBusiness);
	
	if(attendees == null || attendees.isEmpty())
	{
		checkAccessToken();
	
		return graphClient.users().byUserId(meetingOwnerEmail).events().post(event, requestConfiguration -> {
            requestConfiguration.headers.add("Prefer", OUTLOOK_TIMEZONE);
            });
	}
	
	List<Attendee> attendeeList = new ArrayList<>();
	
	for(OnlineMeetingAttendee attendee : attendees)
	{
		Attendee att = new Attendee();
		
		EmailAddress attEmail = new EmailAddress();
		
		attEmail.setAddress(attendee.getEmail());
		
		att.setEmailAddress(attEmail);
		
		attendeeList.add(att);
	}
	
	event.setAttendees(attendeeList);
	
	checkAccessToken();

	Event newEvent = graphClient.users().byUserId(meetingOwnerEmail).events().post(event, requestConfiguration -> {
        requestConfiguration.headers.add("Prefer", OUTLOOK_TIMEZONE);
        });
	
	User user = graphClient.users().byUserId(meetingOwnerEmail).get();

	OnlineMeetingCollectionResponse response = graphClient.users().byUserId(user.getId()).onlineMeetings().get(requestConfiguration -> {
		requestConfiguration.headers.add("Prefer", "include-unknown-enum-members");
		requestConfiguration.queryParameters.filter = "JoinWebUrl eq '" + newEvent.getOnlineMeeting().getJoinUrl() + "'";
		});
	
	OnlineMeeting meeting = response.getValue().get(0);
	
	List<MeetingParticipantInfo> parList = new ArrayList<>();
	
	MeetingParticipants par = new MeetingParticipants();
		
	for(OnlineMeetingAttendee attendee : attendees)
	{
		MeetingParticipantInfo parInfo = new MeetingParticipantInfo();
		
		parInfo.setUpn(attendee.getEmail());
		
		parInfo.setRole(OnlineMeetingRole.valueOf(attendee.getRole().toString()));
		
		parList.add(parInfo);
	}
		
	par.setAttendees(parList);
	
	meeting.setParticipants(par);
	
	LobbyBypassSettings lobbySettings = new LobbyBypassSettings();
		
	lobbySettings.setScope(LobbyBypassScope.Invited);
	
	meeting.setLobbyBypassSettings(lobbySettings);
	
	checkAccessToken();
	
       //ODataError: Updating meeting type is not supported error happening here in 6.6.0 but not 6.4.0
	graphClient.users().byUserId(user.getId()).onlineMeetings().byOnlineMeetingId(meeting.getId()).patch(meeting, requestConfiguration -> {
		requestConfiguration.headers.add("Prefer", "include-unknown-enum-members");
		});
	
	return newEvent;	
}

ccea-dev-team avatar Apr 17 '24 09:04 ccea-dev-team

Some background to setting a meeting co-organizer for an online meeting created from an Event -

https://github.com/microsoftgraph/msgraph-sdk-java/issues/1834

The way that was suggested there by @Ndiritu was to create the online meeting first, set the co-organizer, then use the join url when creating the Event. This didn't work as when the event is saved it overwrites the join url from the online meeting with its own join url. So I had to create the Event first then get the backing online meeting from that event and update the co-organizer on that. This worked fine on version 6.4.0 but now does not work on 6.6.0 with the error -

com.microsoft.graph.models.odataerrors.ODataError: Updating meeting type is not supported.

ccea-dev-team avatar Apr 17 '24 10:04 ccea-dev-team

Thanks for the detailed issue and additional context @ccea-dev-team

Ndiritu avatar Apr 22 '24 12:04 Ndiritu

@ccea-dev-team we've made a couple of fixes relating to this. Could you please upgrade to the latest version and let us know if you're still facing the same issue?

Ndiritu avatar Oct 09 '24 07:10 Ndiritu

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.