Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
JGraph
>
Tutorial
> Create online meeting
The following example shows you how to create an online meeting.
import java.text.SimpleDateFormat; import java.util.Date; import com.independentsoft.graph.GraphClient; import com.independentsoft.graph.GraphException; import com.independentsoft.graph.teams.CommunicationsIdentitySet; import com.independentsoft.graph.teams.CommunicationsUserIdentity; import com.independentsoft.graph.teams.JoinMeetingIdSettings; import com.independentsoft.graph.teams.MeetingParticipantInfo; import com.independentsoft.graph.teams.MeetingParticipants; import com.independentsoft.graph.teams.OnlineMeeting; import com.independentsoft.graph.teams.OnlineMeetingPresenters; import com.independentsoft.graph.users.User; public class Console { public static void main(String[] args) { try { GraphClient client = new GraphClient(); client.setClientId("63333333-209e-454e-b7bd-55a4d201270f"); client.setTenant("independentsoft.onmicrosoft.com"); client.setUsername("info@independentsoft.onmicrosoft.com"); client.setPassword("password"); User info = client.getUser("info@independentsoft.onmicrosoft.com"); User john = client.getUser("john@independentsoft.onmicrosoft.com"); SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); Date startTime = dateFormat.parse("2023-12-20 16:00:00"); Date endTime = dateFormat.parse("2023-12-20 18:00:00"); JoinMeetingIdSettings joinMeetingIdSettings = new JoinMeetingIdSettings(); joinMeetingIdSettings.setPasscodeRequired(true); CommunicationsUserIdentity organizerIdentityUser = new CommunicationsUserIdentity(); organizerIdentityUser.setDisplayName("Info"); organizerIdentityUser.setTenantId("independentsoft.onmicrosoft.com"); organizerIdentityUser.setId(info.getId()); CommunicationsIdentitySet organizerIdentity = new CommunicationsIdentitySet(); organizerIdentity.setUser(organizerIdentityUser); MeetingParticipantInfo organizer = new MeetingParticipantInfo(); organizer.setIdentity(organizerIdentity); CommunicationsUserIdentity userJohn = new CommunicationsUserIdentity(); userJohn.setDisplayName("John"); userJohn.setTenantId("independentsoft.onmicrosoft.com"); userJohn.setId(john.getId()); CommunicationsIdentitySet attendeeIdentity = new CommunicationsIdentitySet(); attendeeIdentity.setUser(userJohn); MeetingParticipantInfo attendee = new MeetingParticipantInfo(); attendee.setIdentity(attendeeIdentity); MeetingParticipants meetingParticipants = new MeetingParticipants(); meetingParticipants.setOrganizer(organizer); meetingParticipants.getAttendees().add(attendee); OnlineMeeting meeting = new OnlineMeeting(); meeting.setAllowedPresenters(OnlineMeetingPresenters.EVERYONE); meeting.setSubject("Online meeting XYZ"); meeting.setStartTime(startTime); meeting.setEndTime(endTime); meeting.setJoinMeetingIdSettings(joinMeetingIdSettings); meeting.setParticipants(meetingParticipants); OnlineMeeting createdOnlineMeeting = client.createOnlineMeeting(meeting); System.out.println("MeetingId = " + createdOnlineMeeting.getJoinMeetingIdSettings().getJoinMeetingId()); System.out.println("Passcode = " + createdOnlineMeeting.getJoinMeetingIdSettings().getPasscode()); System.out.println("JoinWebUrl = " + createdOnlineMeeting.getJoinWebUrl()); } catch (GraphException e) { System.out.println(e.getCode()); System.out.println(e.getMessage()); } catch (Exception e) { System.out.println(e.getMessage()); } } }
Need help? Ask our developers:
Name*
Email*
Message*