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);
}
}
}