public async Task PutAttendeeAsync(Models.Attendee attendee) { var response = await _httpClient.PutAsync($"{_attendeesUri}/{attendee.UserName}", CreateHttpContent(attendee)); response.EnsureSuccessStatusCode(); }
public static DTO.Attendee ToDto(this Models.Attendee src) { return(Mapper.Map <DTO.Attendee>(src)); }
/// <summary> /// Runs job /// </summary> /// <param name="state">state information</param> private async void RunJob(object state) { try { string token = await AuthenticationHelper.GetAccessTokenAsync(_configuration, _httpClientFactory); GraphServiceClient graphserviceClient = new GraphServiceClient( new DelegateAuthenticationProvider( (requestMessage) => { requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", token); return(Task.FromResult(0)); })); var callsInformation = await DocumentDBRepository.GetItemsAsync <CallInfo>(c => c.Status == null); foreach (var call in callsInformation) { try { var participants = await graphserviceClient.Communications.Calls[call.CallId.ToString()].Participants .Request() .GetAsync(); var attendees = new List <Models.Attendee>(); foreach (var participant in participants.CurrentPage) { if (participant.Info.Identity.User != null) { var attendee = new Models.Attendee() { DisplayName = participant.Info.Identity.User.DisplayName, AadId = participant.Info.Identity.User.Id, }; attendees.Add(attendee); } } var meetingAttendees = new MeetingAttendees() { LogTime = DateTime.UtcNow.ToString(), CallId = call.CallId, EventId = call.EventId, ListOfAttendees = attendees }; if (meetingAttendees.ListOfAttendees.Count > 0) { await DocumentDBRepository.CreateItemAsync <MeetingAttendees>(meetingAttendees); } } catch (Exception e) { _logger.LogError(e.Message + ' ' + e.StackTrace); if (((ServiceException)e).StatusCode == System.Net.HttpStatusCode.NotFound) { call.Status = (int?)System.Net.HttpStatusCode.NotFound; await DocumentDBRepository.UpdateItemAsync(call.Id, call); } } } } catch (Exception e) { _logger.LogError(e.Message + ' ' + e.StackTrace); } }