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

Run() public static method

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

                MsgLoadOptions options = new MsgLoadOptions();
                options.PreserveTnefAttachments = true;

                // load task from .msg file
                MailMessage eml = MailMessage.Load(dataDir + "task.msg", options);
                eml.From = "[email protected]";
                eml.To.Clear();
                eml.To.Add(new MailAddress("[email protected]"));
                client.Send(eml);
                // ExEnd:SendTaskRequestUsingIEWSClient
            }
            catch (Exception ex)
            {
                Console.Write(ex.Message);
            }
        }
    }
SendTaskRequestUsingIEWSClient