コード例 #1
0
        public static void Run()
        {
            //ExStart: MoveItemsToInPlaceArchive
            const string      mailboxUri  = "<HOST>";
            const string      domain      = @"";
            const string      username    = @"<USERNAME>";
            const string      password    = @"<PASSWORD>";
            NetworkCredential credentials = new NetworkCredential(username, password, domain);
            IEWSClient        client      = EWSClient.GetEWSClient(mailboxUri, credentials);

            ExchangeMessageInfoCollection msgCollection = client.ListMessages(client.MailboxInfo.InboxUri);

            foreach (ExchangeMessageInfo msgInfo in msgCollection)
            {
                Console.WriteLine("Subject:" + msgInfo.Subject);
                client.ArchiveItem(client.MailboxInfo.InboxUri, msgInfo.UniqueUri);
            }
            client.Dispose();
            //ExEnd: MoveItemsToInPlaceArchive
        }