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

Run() public static method

public static Run ( ) : void
return void
        public static void Run()
        {
            const string mailboxUri = "https://exchange/ews/exchange.asmx";
            const string domain = @"";
            const string username = @"[email protected]";
            const string password = @"password";
            NetworkCredential credentials = new NetworkCredential(username, password, domain);
            IEWSClient client = EWSClient.GetEWSClient(mailboxUri, credentials);
            Console.WriteLine("Connected to Exchange 2010");
            // ExStart:CopyConversations
            // Find those Conversation Items in the Inbox folder which we want to copy
            ExchangeConversation[] conversations = client.FindConversations(client.MailboxInfo.InboxUri);
            foreach (ExchangeConversation conversation in conversations)
            {
                Console.WriteLine("Topic: " + conversation.ConversationTopic);
                // Copy the conversation item based on some condition
                if (conversation.ConversationTopic.Contains("test email") == true)
                {
                    client.CopyConversationItems(conversation.ConversationId, client.MailboxInfo.DeletedItemsUri);
                    Console.WriteLine("Copied the conversation item to another folder");
                }
            }
            // ExEnd:CopyConversations
        }
    }
CopyConversations