/// <summary> /// Gets the request builder for OnlineMeetingCreateOrGet. /// </summary> /// <returns>The <see cref="IOnlineMeetingCreateOrGetRequestBuilder"/>.</returns> public IOnlineMeetingCreateOrGetRequestBuilder CreateOrGet( string externalId, ChatInfo chatInfo = null, DateTimeOffset?endDateTime = null, MeetingParticipants participants = null, DateTimeOffset?startDateTime = null, string subject = null) { return(new OnlineMeetingCreateOrGetRequestBuilder( this.AppendSegmentToRequestUrl("microsoft.graph.createOrGet"), this.Client, externalId, chatInfo, endDateTime, participants, startDateTime, subject)); }
/// <summary> /// Constructs a new <see cref="OnlineMeetingCreateOrGetRequestBuilder"/>. /// </summary> /// <param name="requestUrl">The URL for the request.</param> /// <param name="client">The <see cref="IBaseClient"/> for handling requests.</param> /// <param name="externalId">A externalId parameter for the OData method call.</param> /// <param name="chatInfo">A chatInfo parameter for the OData method call.</param> /// <param name="endDateTime">A endDateTime parameter for the OData method call.</param> /// <param name="participants">A participants parameter for the OData method call.</param> /// <param name="startDateTime">A startDateTime parameter for the OData method call.</param> /// <param name="subject">A subject parameter for the OData method call.</param> public OnlineMeetingCreateOrGetRequestBuilder( string requestUrl, IBaseClient client, string externalId, ChatInfo chatInfo, DateTimeOffset?endDateTime, MeetingParticipants participants, DateTimeOffset?startDateTime, string subject) : base(requestUrl, client) { this.SetParameter("externalId", externalId, false); this.SetParameter("chatInfo", chatInfo, true); this.SetParameter("endDateTime", endDateTime, true); this.SetParameter("participants", participants, true); this.SetParameter("startDateTime", startDateTime, true); this.SetParameter("subject", subject, true); }
//Create Meet Now Online meeting and schedule it in atendees calendars static public async Task <OnlineMeeting> CreateOnlineMeeting(string meetingSubject, string organizerEmail, string[] atendees, DateTime startDateTime, DateTime endDateTime) { var graphClient = await CreateGraphClient(); var requestUrl = "https://graph.microsoft.com/beta/app/onlineMeetings"; HttpRequestMessage message = new HttpRequestMessage(HttpMethod.Post, requestUrl); message.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); await graphClient.AuthenticationProvider.AuthenticateRequestAsync(message); var participants = new Microsoft.Graph.MeetingParticipants { Organizer = new MeetingParticipantInfo { Identity = new IdentitySet { User = new Identity { Id = await GetUserFromEmail(organizerEmail) } } } }; var attendeeList = new List <MeetingParticipantInfo>(); foreach (var atendeee in atendees) { var identity = new IdentitySet { User = new Identity { Id = await GetUserFromEmail(organizerEmail) } }; attendeeList.Add( new MeetingParticipantInfo { Identity = identity }); } participants.Attendees = attendeeList; OnlineMeeting onlineMeeting = new OnlineMeeting { Subject = meetingSubject, Participants = participants }; //Remove audioConferencing property from JSON JObject jobt = (JObject)JToken.FromObject(onlineMeeting); jobt.Remove("audioConferencing"); message.Content = new StringContent(jobt.ToString(), System.Text.Encoding.UTF8, "application/json"); HttpResponseMessage response = await graphClient.HttpProvider.SendAsync(message); if (response.IsSuccessStatusCode) { var content = await response.Content.ReadAsStringAsync(); var oData = graphClient.HttpProvider.Serializer.DeserializeObject <JObject>(content); OnlineMeeting meetingCreated = graphClient.HttpProvider.Serializer.DeserializeObject <OnlineMeeting>(oData.ToString()); try { var a = await ScheduleCalendarEvent(meetingSubject, meetingCreated.JoinUrl, startDateTime, endDateTime, organizerEmail, atendees); } catch (Exception) { throw; } return(meetingCreated); } else { throw new ServiceException( new Error { Code = response.StatusCode.ToString(), Message = await response.Content.ReadAsStringAsync() } ); } }