Ejemplo n.º 1
0
        public static async Task ContinueAsync(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();

            var RoomList = await client.GetRoomList();

            var KG = me.CompanyName;

            //var Sala = await client.FindRoomAsync();
            string[] Sala  = { "Sala one", "Sala two", "Sala three" }; //lo puse yo
            var      reply = turnContext.Activity.CreateReply();

            reply.Text        = $"You are in {me} .n {me.Mail}  {me.CompanyName} and {me.Manager}";
            reply.Attachments = new List <Attachment> {
                Cards.CreateHeroCard(KG, Sala).ToAttachment()
            };
            await turnContext.SendActivityAsync(reply);
        }
Ejemplo n.º 2
0
        // Gets recent mail the user has received within the last hour and displays up
        // to 5 of the emails in the bot.
        public static async Task ListRecentMailAsync(ITurnContext turnContext, TokenResponse tokenResponse)
        {
            if (turnContext == null)
            {
                throw new ArgumentNullException(nameof(turnContext));
            }

            if (tokenResponse == null)
            {
                throw new ArgumentNullException(nameof(tokenResponse));
            }

            var client   = new SimpleGraphClient(tokenResponse.Token);
            var messages = await client.GetRecentMailAsync();

            var reply = turnContext.Activity.CreateReply();

            if (messages.Any())
            {
                var count = messages.Length;
                if (count > 5)
                {
                    count = 5;
                }

                reply.Attachments      = new List <Attachment>();
                reply.AttachmentLayout = AttachmentLayoutTypes.Carousel;

                for (var i = 0; i < count; i++)
                {
                    var mail = messages[i];
                    var card = new HeroCard(
                        mail.Subject,
                        $"{mail.From.EmailAddress.Name} <{mail.From.EmailAddress.Address}>",
                        mail.BodyPreview,
                        new List <CardImage>()
                    {
                        new CardImage(
                            "https://botframeworksamples.blob.core.windows.net/samples/OutlookLogo.jpg",
                            "Outlook Logo"),
                    });
                    reply.Attachments.Add(card.ToAttachment());
                }
            }
            else
            {
                reply.Text = "Unable to find any recent unread mail.";
            }

            await turnContext.SendActivityAsync(reply);
        }
Ejemplo n.º 3
0
        // 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.");
        }
Ejemplo n.º 4
0
        public static async Task ListMeetingTimesAsync(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 MeetingTimes = await client.FindRoomAsync(DateTime.Now, DateTime.Now.AddDays(24), "Teststrins", "Test room", "*****@*****.**");



            var reply = turnContext.Activity.CreateReply();

            reply.Text = $"You are {MeetingTimes} and I don't give a shhh";
            await turnContext.SendActivityAsync(reply);
        }
Ejemplo n.º 5
0
        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();

            // var RoomList = await client.GetList();
            //var manager = await client.GetManagerAsync(); //by art
            // var photoResponse = await client.GetPhotoAsync(); //by art

            // Generate the reply activity.
            var reply = turnContext.Activity.CreateReply();

            //var photoText = string.Empty;
            //if (photoResponse != null)//by art
            //{//by art
            //    var replyAttachment = new Attachment(photoResponse.ContentType, photoResponse.Base64String);//by art
            //    reply.Attachments.Add(replyAttachment);//by art
            //}//by art
            //else//by art
            //{//by art
            //    photoText = "Consider adding an image to your Outlook profile.";//by art
            //}//by art

            reply.Text = $"You are {me} and youre in {me.CompanyName}";
            await turnContext.SendActivityAsync(reply);
        }