Aspose.Email.Examples.CSharp.Email.Exchange.SendMeetingRequestsUsingEWS.Run C# (CSharp) Method

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            // ExStart:SendMeetingRequestsUsingEWS
            try
            {
                // Create instance of IEWSClient class by giving credentials
                IEWSClient client = EWSClient.GetEWSClient("https://outlook.office365.com/ews/exchange.asmx", "testUser", "pwd", "domain");

                // Create the meeting request
                Appointment app = new Appointment("meeting request", DateTime.Now.AddHours(1), DateTime.Now.AddHours(1.5), "[email protected]", "[email protected]");
                app.Summary = "meeting request summary";
                app.Description = "description";


                Aspose.Email.Recurrences.RecurrencePattern pattern = new Recurrences.DailyRecurrencePattern(DateTime.Now.AddDays(5));
                app.Recurrence = pattern;

                // Create the message and set the meeting request
                MailMessage msg = new MailMessage();
                msg.From = "[email protected]";
                msg.To = "[email protected]";
                msg.IsBodyHtml = true;
                msg.HtmlBody = "<h3>HTML Heading</h3><p>Email Message detail</p>";
                msg.Subject = "meeting request";
                msg.AddAlternateView(app.RequestApointment(0));

                // send the appointment
                client.Send(msg);
                Console.WriteLine("Appointment request sent");
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            // ExEnd:SendMeetingRequestsUsingEWS
        }        
    }
SendMeetingRequestsUsingEWS