예제 #1
0
파일: Form1.cs 프로젝트: csai38/ProjectTm
        private void button1_Click(object sender, EventArgs e)
        {
            Exchange.ExchangeService eService = new Exchange.ExchangeService(Exchange.ExchangeVersion.Exchange2007_SP1);
            eService.Credentials = new Exchange.WebCredentials("*****@*****.**", "sFx2Dobay");
            eService.Url         = new Uri("https://outlook.office365.com/ews/Exchange.asmx");
            //eService.TimeZone = TimeZoneInfo.Local;
            //eService.ImpersonatedUserId = new Exchange.ImpersonatedUserId(Exchange.ConnectingIdType.SmtpAddress, "*****@*****.**");
            Exchange.Task nTask = new Exchange.Task(eService);

            Exchange.MessageBody messageBody = new Exchange.MessageBody(Exchange.BodyType.HTML, "Необходимо строчно сделать эту работу");

            nTask.Body          = messageBody;
            nTask.Subject       = "Очень важная задача";
            nTask.Importance    = Exchange.Importance.High;
            nTask.StartDate     = DateTime.Today.AddDays(1).AddHours(8);
            nTask.IsReminderSet = true;
            nTask.DueDate       = DateTime.Today.AddDays(3).AddHours(14);
            nTask.Save(new Exchange.FolderId(Exchange.WellKnownFolderName.Tasks, new Exchange.Mailbox("*****@*****.**")));
        }
 /// <summary>
 /// Forwards the message. Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="bodyPrefix">The prefix to prepend to the original body of the message.</param>
 /// <param name="toRecipients">The recipients to forward the message to.</param>
 public void Forward(MessageBody bodyPrefix, params EmailAddress[] toRecipients)
 {
     this.Forward(bodyPrefix, (IEnumerable <EmailAddress>)toRecipients);
 }
예제 #3
0
 /// <summary>
 /// Forwards the appointment. Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="bodyPrefix">The prefix to prepend to the original body of the message.</param>
 /// <param name="toRecipients">The recipients to forward the appointment to.</param>
 public System.Threading.Tasks.Task Forward(MessageBody bodyPrefix, params EmailAddress[] toRecipients)
 {
     return(this.Forward(bodyPrefix, (IEnumerable <EmailAddress>)toRecipients));
 }
예제 #4
0
        /// <summary>
        /// Forwards the appointment. Calling this method results in a call to EWS.
        /// </summary>
        /// <param name="bodyPrefix">The prefix to prepend to the original body of the message.</param>
        /// <param name="toRecipients">The recipients to forward the appointment to.</param>
        public void Forward(MessageBody bodyPrefix, IEnumerable<EmailAddress> toRecipients)
        {
            ResponseMessage responseMessage = this.CreateForward();

            responseMessage.BodyPrefix = bodyPrefix;
            responseMessage.ToRecipients.AddRange(toRecipients);

            responseMessage.SendAndSaveCopy();
        }
예제 #5
0
 /// <summary>
 /// Forwards the appointment. Calling this method results in a call to EWS.
 /// </summary>
 /// <param name="bodyPrefix">The prefix to prepend to the original body of the message.</param>
 /// <param name="toRecipients">The recipients to forward the appointment to.</param>
 public void Forward(MessageBody bodyPrefix, params EmailAddress[] toRecipients)
 {
     this.Forward(bodyPrefix, (IEnumerable<EmailAddress>)toRecipients);
 }
예제 #6
0
        /// <summary>
        /// Replies to the organizer and/or the attendees of the meeting. Calling this method results in a call to EWS.
        /// </summary>
        /// <param name="bodyPrefix">The prefix to prepend to the body of the meeting.</param>
        /// <param name="replyAll">Indicates whether the reply should go to the organizer only or to all the attendees.</param>
        public void Reply(MessageBody bodyPrefix, bool replyAll)
        {
            ResponseMessage responseMessage = this.CreateReply(replyAll);

            responseMessage.BodyPrefix = bodyPrefix;

            responseMessage.SendAndSaveCopy();
        }
예제 #7
0
        /// <summary>
        /// Posts a reply to this post item. Calling this method results in a call to EWS.
        /// </summary>
        /// <param name="bodyPrefix">Body prefix.</param>
        public void PostReply(MessageBody bodyPrefix)
        {
            PostReply postReply = this.CreatePostReply();

            postReply.BodyPrefix = bodyPrefix;

            postReply.Save();
        }
예제 #8
0
        /// <summary>
        /// process email after full sync
        /// </summary>
        /// <param name="emailId"></param>
        /// <param name="hasAttachments"></param>
        /// <param name="body"></param> 
        public static void UpdateEmail(int emailId, bool hasAttachments, MessageBody body)
        {
            var objCtx = new dbDataContext();
            var email = (from m in objCtx.tbl_Emails where m.EmailId == emailId select m).FirstOrDefault();

            if (email != null)
            {
                email.Body = body;
                email.HasAttachments = hasAttachments;
                email.Synced = 2;
            }
            //update
            objCtx.SubmitChanges();
        }
예제 #9
0
        private static void SendEmailWithReport(ExchangeService service, string recipient)
        {
            EmailMessage email = new EmailMessage(service);
            EmailAddress to = new EmailAddress();
            MessageBody body = new MessageBody();
            body.BodyType = BodyType.HTML;
            body.Text = "sample body.";
            var subject = "Sample subject " + DateTime.Now;

            to.Address = recipient;
            email.ToRecipients.Add(to);
            email.Subject = subject;

            email.Body = body + "\r\n" + File.ReadAllText(@"C:\sample.html");

            email.Send();
        }