2010-05-18 102 views

回答

0

嘗試下面的代碼,click here to read more

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

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

     service.AutodiscoverUrl("[email protected]"); 

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

     foreach (Item item in findResults.Items) 
      Console.WriteLine(item.Subject); 
    } 
6
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; 
相關問題