Independentsoft
- any library, any programming language
Home
Purchase
Support
Company
Contact
Graph .NET
>
Tutorial
> Create online meeting
The following example shows you how to create an online meeting.
C# example
using System; using System.Threading.Tasks; using Independentsoft.Graph; using Independentsoft.Graph.Teams; using Independentsoft.Graph.Users; namespace ConsoleApp1 { class Program { static async Task Main() { try { GraphClient client = new GraphClient(); client.ClientId = "63333333-209e-454e-b7bd-55a4d201270f"; client.Tenant = "independentsoft.onmicrosoft.com"; client.Username = "info@independentsoft.onmicrosoft.com"; client.Password = "password"; User info = await client.GetUser("info@independentsoft.onmicrosoft.com"); User john = await client.GetUser("john@independentsoft.onmicrosoft.com"); JoinMeetingIdSettings joinMeetingIdSettings = new JoinMeetingIdSettings(); joinMeetingIdSettings.IsPasscodeRequired = true; CommunicationsIdentitySet organizerIdentity = new CommunicationsIdentitySet(); organizerIdentity.User = new CommunicationsUserIdentity(); organizerIdentity.User.DisplayName = "Info"; organizerIdentity.User.TenantId = "independentsoft.onmicrosoft.com"; organizerIdentity.User.Id = info.Id; MeetingParticipantInfo organizer = new MeetingParticipantInfo(); organizer.Identity = organizerIdentity; CommunicationsUserIdentity userJohn = new CommunicationsUserIdentity(); userJohn.DisplayName = "John"; userJohn.TenantId = "independentsoft.onmicrosoft.com"; userJohn.Id = john.Id; CommunicationsIdentitySet attendeeIdentity = new CommunicationsIdentitySet(); attendeeIdentity.User = userJohn; MeetingParticipantInfo attendee = new MeetingParticipantInfo(); attendee.Identity = attendeeIdentity; MeetingParticipants meetingParticipants = new MeetingParticipants(); meetingParticipants.Organizer = organizer; meetingParticipants.Attendees.Add(attendee); OnlineMeeting meeting = new OnlineMeeting(); meeting.AllowedPresenters = OnlineMeetingPresenters.Everyone; meeting.Subject = "Online meeting XYZ"; meeting.StartTime = DateTime.Now.AddDays(1); meeting.EndTime = DateTime.Now.AddDays(1).AddHours(2); OnlineMeeting createdOnlineMeeting = await client.CreateOnlineMeeting(meeting); Console.WriteLine("MeetingId = " + createdOnlineMeeting.JoinMeetingIdSettings.JoinMeetingId); Console.WriteLine("Passcode = " + createdOnlineMeeting.JoinMeetingIdSettings.Passcode); Console.WriteLine("JoinWebUrl = " + createdOnlineMeeting.JoinWebUrl); } catch (GraphException ex) { Console.WriteLine("Error: " + ex.Code); Console.WriteLine("Message: " + ex.Message); } } } }
VB example
Imports Independentsoft.Graph Imports Independentsoft.Graph.Users Imports Independentsoft.Graph.Teams Namespace Sample Class Module1 Shared Sub Main(ByVal args As String()) Dim task = New Task(AddressOf Run) ' Start and wait for task to end. task.Start() Console.Read() End Sub Shared Async Sub Run() Try Dim client As GraphClient = New GraphClient() client.ClientId = "63333333-209e-454e-b7bd-55a4d201270f" client.Tenant = "independentsoft.onmicrosoft.com" client.Username = "info@independentsoft.onmicrosoft.com" client.Password = "password" Dim info As User = Await client.GetUser("info@independentsoft.onmicrosoft.com") Dim john As User = Await client.GetUser("john@independentsoft.onmicrosoft.com") Dim joinMeetingIdSettings As JoinMeetingIdSettings = New JoinMeetingIdSettings() joinMeetingIdSettings.IsPasscodeRequired = True Dim organizerIdentity As CommunicationsIdentitySet = New CommunicationsIdentitySet() organizerIdentity.User = New CommunicationsUserIdentity() organizerIdentity.User.DisplayName = "Info" organizerIdentity.User.TenantId = "independentsoft.onmicrosoft.com" organizerIdentity.User.Id = info.Id Dim organizer As MeetingParticipantInfo = New MeetingParticipantInfo() organizer.Identity = organizerIdentity Dim userJohn As CommunicationsUserIdentity = New CommunicationsUserIdentity() userJohn.DisplayName = "John" userJohn.TenantId = "independentsoft.onmicrosoft.com" userJohn.Id = john.Id Dim attendeeIdentity As CommunicationsIdentitySet = New CommunicationsIdentitySet() attendeeIdentity.User = userJohn Dim attendee As MeetingParticipantInfo = New MeetingParticipantInfo() attendee.Identity = attendeeIdentity Dim meetingParticipants As MeetingParticipants = New MeetingParticipants() meetingParticipants.Organizer = organizer meetingParticipants.Attendees.Add(attendee) Dim meeting As OnlineMeeting = New OnlineMeeting() meeting.AllowedPresenters = OnlineMeetingPresenters.Everyone meeting.Subject = "Online meeting XYZ" meeting.StartTime = Date.Now.AddDays(1) meeting.EndTime = Date.Now.AddDays(1).AddHours(2) Dim createdOnlineMeeting As OnlineMeeting = Await client.CreateOnlineMeeting(meeting) Console.WriteLine("MeetingId = " & createdOnlineMeeting.JoinMeetingIdSettings.JoinMeetingId) Console.WriteLine("Passcode = " & createdOnlineMeeting.JoinMeetingIdSettings.Passcode) Console.WriteLine("JoinWebUrl = " & createdOnlineMeeting.JoinWebUrl) Catch ex As GraphException Console.WriteLine("Error: " + ex.Code) Console.WriteLine("Error: " + ex.Message) End Try End Sub End Class End Namespace
Need help? Ask our developers:
Name*
Email*
Message*