Esempio n. 1
0
        private async Task <DialogTurnResult> SendMeetingInvite(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            string description   = (string)stepContext.Context.TurnState["data"];
            var    tokenResponse = (TokenResponse)stepContext.Result;

            if (tokenResponse?.Token != null)
            {
                var           client        = new SimpleGraphClient(tokenResponse.Token);
                MeetingDetail meetingDetail = await RetrieveMeetingDetailsAsync(table, userEmail, stepContext.Context.Activity.Conversation.Id);                            //retrieves current meeting details

                await client.SendMeetingInviteAsync(timeSuggestions[Int32.Parse(meetingDetail.TimeSlotChoice)], meetingDetail.Attendees, meetingDetail.Title, description); //creates event

                await stepContext.Context.SendActivityAsync("Meeting has been scheduled. Thank you!");
            }
            else
            {
                await stepContext.Context.SendActivityAsync("Something went wrong. Please type anything to get started again.");
            }
            return(await stepContext.EndDialogAsync(cancellationToken : cancellationToken));
        }