簡體   English   中英

如何使用Exchange Web服務從Exchange Server 2007獲取所有未讀郵件?

[英]How to Get all unread mails from Exchange server 2007 using Exchange web service?

如何使用Exchange Web服務從Exchange Server 2007獲取所有未讀郵件?

int unreadEmailCount = 0;

        SearchFilter searchFilter = new SearchFilter.SearchFilterCollection(LogicalOperator.And, new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false));

        ItemView view = new ItemView(999);

        FindItemsResults<Item> findResults = service.FindItems(WellKnownFolderName.Inbox, searchFilter, view);
        unreadEmailCount = findResults.Items.Count;

嘗試下面的代碼, 單擊此處了解更多

    static void Main(string[] args)
    {
        ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1);

        service.Credentials = new NetworkCredential("Active Dir ID", "password", "domain name");

        service.AutodiscoverUrl("user@domain.com");

        FindItemsResults<Item> findResults = service.FindItems(
            WellKnownFolderName.Inbox,
            new ItemView(10));

        foreach (Item item in findResults.Items)
            Console.WriteLine(item.Subject);
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM