public static async Task ListMe(ITurnContext context, TokenResponse tokenResponse) { var token = tokenResponse; var client = new SimpleGraphClient(token.Token); var me = await client.GetMe(); var manager = await client.GetManager(); var reply = context.Activity.CreateReply(); var photoResponse = await client.GetPhoto(); var photoText = string.Empty; if (photoResponse != null) { var replyAttachment = new Attachment(photoResponse.ContentType, photoResponse.Base64string); reply.Attachments.Add(replyAttachment); } else { photoText = "You should really add an image to your Outlook profile :)"; } reply.Text = $"You are {me.DisplayName} and you report to {manager.DisplayName}. {photoText}"; await context.SendActivityAsync(reply); }
public static async Task SendMail(ITurnContext context, TokenResponse tokenResponse, string recipient) { var token = tokenResponse; var client = new SimpleGraphClient(token.Token); var me = await client.GetMe(); await client.SendMail(recipient, "Message from a bot!", $"Hi there! I had this message sent from a bot. - Your friend, {me.DisplayName}"); await context.SendActivityAsync($"I sent a message to '{recipient}' from your account :)"); }