예제 #1
0
        public async Task<EmailMessage> GetEmailMessage(string messageID)
        {
            JObject result = await QueryGraph("users/" + SettingsHelper.HelpDeskEmailAddress + "/messages/" + messageID);

            EmailMessage emailMessage = new EmailMessage();
            emailMessage.MessageID = result["id"].ToString();
            emailMessage.Sender = result["sender"]["emailAddress"]["name"].ToString();
            emailMessage.SentTimestamp = result["sentDateTime"].ToString();
            emailMessage.Subject = result["subject"].ToString();
            emailMessage.Body = result["body"]["content"].ToString();

            return emailMessage;
        }
예제 #2
0
        public async Task<IEnumerable<EmailMessage>> GetNewEmailMessages()
        {
            JObject results = await QueryGraph("users/" + SettingsHelper.HelpDeskEmailAddress + "/mailFolders/Inbox/messages");

            List<EmailMessage> emailMessages = new List<EmailMessage>();

            foreach(JToken result in results["value"])
            {
                if (!result["categories"].Any())
                {
                    EmailMessage emailMessage = new EmailMessage();
                    emailMessage.MessageID = result["id"].ToString();
                    emailMessage.Sender = result["sender"]["emailAddress"]["name"].ToString();
                    emailMessage.SentTimestamp = result["sentDateTime"].ToString();
                    emailMessage.Subject = result["subject"].ToString();
                    emailMessage.Body = result["body"]["content"].ToString();

                    emailMessages.Add(emailMessage);
                }
            }

            return emailMessages;
        }