Setting a Co-organizier in OnlineMeeting
Hi, I'm using the MS Graph API with Java and I have a question about creating an online meeting with a cohost. I can create the Event fine using the Event object, along with attendees which is part of the Event object, but I want to set 1 of the attendees as a co-host. The process for this is very convoluted. It seems I cannot do this through the Event object but have to get the OnlineMeeting object and set one of the MeetingParticipentsInfo as co-organizer. My question is how do I do this? How do I get the OnlineMeeting object using the Event object data? So far I have something like the code below. I have created an Event object and set the details and attendees for it and called post to save it. Now I want to set a co-organizer but have to get the OnlineMeeting object. How is this done?
Event event =
event.setSubject(meetingName);
event.setBody(
event.getBody().setContentType(BodyType.
event.getBody().setContent(meetingInviteBody);
event.setStart(
event.getStart().setTimeZone(
event.getStart().setDateTime(
event.setEnd(
event.getEnd().setTimeZone(
event.getEnd().setDateTime(
event.setLocation(
event.getLocation().setDisplayName(
event.setAllowNewTimeProposals(
event.setIsOnlineMeeting(
event.setOnlineMeetingProvider(OnlineMeetingProviderType.
if
{
List<Attendee> attendeeList =
for
{
Attendee att =
EmailAddress attEmail =
attEmail.setAddress(attendee);
att.setEmailAddress(attEmail);
attendeeList.add(att);
}
event.setAttendees(attendeeList);
}
Event newEvent = graphClient.users().byUserId(emailOfMeetingOwner).events().post(event,
requestConfiguration -> {requestConfiguration.headers.add("Prefer", OUTLOOK_TIMEZONE);
});
if(meetingCohost != null)
{
OnlineMeeting meeting = graphClient.users().byUserId(emailOfMeetingOwner).onlineMeetings().get();
for(MeetingParticipantInfo meetingPar : meeting.getParticipants().getAttendees())
{
if(meetingPar.getUpn().equals(meetingCohost))
{
meetingPar.setRole(OnlineMeetingRole.Coorganizer);
}
}
}