public static void Run()
{
// ExStart:CopyingMessageToAnotherFolder
try
{
// Create instance of EWSClient class by giving credentials
IEWSClient client = EWSClient.GetEWSClient("https://outlook.office365.com/ews/exchange.asmx", "testUser", "pwd", "domain");
MailMessage message = new MailMessage("[email protected]", "[email protected]", "EMAILNET-34997 - " + Guid.NewGuid().ToString(), "EMAILNET-34997 Exchange: Copy a message and get reference to the new Copy item");
string messageUri = client.AppendMessage(message);
string newMessageUri = client.CopyItem(messageUri, client.MailboxInfo.DeletedItemsUri);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
// ExEnd:CopyingMessageToAnotherFolder
}
}