// Displays information about the user in the bot. public static async Task ListMeAsync(ITurnContext turnContext, TokenResponse tokenResponse) { if (turnContext == null) { throw new ArgumentNullException(nameof(turnContext)); } if (tokenResponse == null) { throw new ArgumentNullException(nameof(tokenResponse)); } // Pull in the data from the Microsoft Graph. var client = new SimpleGraphClient(tokenResponse.Token); var me = await client.GetMeAsync(); await turnContext.SendActivityAsync($"You are {me.DisplayName}."); }
// Enable the user to send an email via the bot. public static async Task SendMailAsync(ITurnContext turnContext, TokenResponse tokenResponse, string recipient) { if (turnContext == null) { throw new ArgumentNullException(nameof(turnContext)); } if (tokenResponse == null) { throw new ArgumentNullException(nameof(tokenResponse)); } var client = new SimpleGraphClient(tokenResponse.Token); var me = await client.GetMeAsync(); await client.SendMailAsync( recipient, "Message from a bot!", $"Hi there! I had this message sent from a bot. - Your friend, {me.DisplayName}"); await turnContext.SendActivityAsync( $"I sent a message to '{recipient}' from your account."); }