Example #1
0
        public object applyOn(SpotterJson spotter)
        {
            var root = spotter.GetRoot();
            var mail = new MailMsg();

            if (root.XPathSelectElement("/result/message") != null)
            {
                // there should be only one message in response to display message
                foreach (var msg in root.XPathSelectElements("/result/message/item"))
                {
                    mail.Subject      = msg.XPathSelectElement("header/subject").Value;
                    mail.From         = msg.XPathSelectElement("header/from/email").Value;
                    mail.To           = YahooGetListedMessages.GetAllInArray(msg, "header/to//email", "; ");
                    mail.Cc           = YahooGetListedMessages.GetAllInArray(msg, "header/cc//email", "; ");
                    mail.Bcc          = YahooGetListedMessages.GetAllInArray(msg, "header/bcc//email", "; ");
                    mail.Body         = YahooGetListedMessages.GetAllInArray(msg, "part//text", "");
                    mail.SourceFolder = msg.XPathSelectElement("sourceFolderInfo/name").Value;
                }
            }

            return(mail);
        }
        public object applyOn(SpotterJson spotter)
        {
            var root = spotter.GetRoot();
            var list = new List <MailMsg>();

            if (root.XPathSelectElement("/result//messageInfo") != null)
            {
                foreach (var conversation in root.XPathSelectElements("/result//messageInfo"))
                {
                    foreach (var msg in conversation.XPathSelectElements("item"))
                    {
                        var mail = new MailMsg();
                        mail.From         = msg.XPathSelectElement("from/email").Value;
                        mail.To           = msg.XPathSelectElement("toEmail").Value;
                        mail.Subject      = msg.XPathSelectElement("subject").Value;
                        mail.Body         = msg.XPathSelectElement("snippet").Value;
                        mail.SourceFolder = msg.XPathSelectElement("sourceFolderInfo/name").Value;
                        list.Add(mail);
                    }
                }
            }
            return(list);
        }