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

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            // ExStart:SendMeetingRequestsUsingExchangeServer
            try
            {
                string mailboxUri = @"https://ex07sp1/exchange/administrator"; // WebDAV
                string domain = @"litwareinc.com";
                string username = @"administrator";
                string password = @"Evaluation1";

                NetworkCredential credential = new NetworkCredential(username, password, domain);
                Console.WriteLine("Connecting to Exchange server.....");
                // Connect to Exchange Server
                ExchangeClient client = new ExchangeClient(mailboxUri, credential); // WebDAV

                // Create the meeting request
                Appointment app = new Appointment("meeting request", DateTime.Now.AddHours(1), DateTime.Now.AddHours(1.5), "administrator@" + domain, "bob@" + domain);
                app.Summary = "meeting request summary";
                app.Description = "description";

                // Create the message and set the meeting request
                MailMessage msg = new MailMessage();
                msg.From = "administrator@" + domain;
                msg.To = "bob@" + domain;
                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:SendMeetingRequestsUsingExchangeServer
        }        
    }
SendMeetingRequestsUsingExchangeServer