2011-06-20 6 views
0

私は以前には一度も働いたことのない仕事に取り組んでいます。EWSマネージドAPIを使用した新しい電子メールメッセージのメールボックスのモニタ

タスク: Exchange Server 2007の特定のメールボックス受信トレイを監視します。すべてのメールメッセージ(メールのみ)を繰り返し処理して、同じメールボックスの特定のフォルダに移動します。

仕事は私は私が常に= 9 results.items.countを取得するいくつかの理由

// Create the binding 
ExchangeService service = new ExchangeService(ExchangeVersion.Exchange2007_SP1); 
//service.Credentials = new WebCredentials("mailbox", "password", "[email protected]"); 
service.Credentials = new NetworkCredential(ConfigurationManager.AppSettings["ExchangeUsername"].ToString(), ConfigurationManager.AppSettings["ExchangePassword"].ToString(), "something/domain"); 
// Set the url. 
//service.AutodiscoverUrl("[email protected]"); 
service.Url = new Uri(ServiceUrl); 
ItemView view = new ItemView(10); 
view.Traversal = ItemTraversal.Shallow; 
view.PropertySet = new PropertySet(BasePropertySet.IdOnly); 
List<SearchFilter> searchFilterCollection = new List<SearchFilter>(); 
//searchFilterCollection.Add(new SearchFilter.ContainsSubstring(ItemSchema.ItemClass, "MessageType")); 
searchFilterCollection.Add(new SearchFilter.ContainsSubstring(ItemSchema.Subject, "test to be deleted")); 
SearchFilter searchFilter = new SearchFilter.SearchFilterCollection(LogicalOperator.Or, searchFilterCollection.ToArray()); 

FindItemsResults<Item> results = service.FindItems(WellKnownFolderName.Inbox, view); 

をしましたが、M[email protected]で唯一のEmailMessageのがあります。私は何かを間違って検索していますか?受信トレイに5つの電子メールがある場合は、5をカウントし、5つの電子メールをループする必要があります。電子メールメッセージだけを照会する方法はありますか?どんな助けもありがとうございます。ありがとうございました。

答えて

0

私は自分の質問にしばらく前に答えましたが、ここで更新するのを忘れました。だから私はカウントが一致していないと言って、それは偽装アカウントのメールボックスを監視していた。偶然、偽装アカウントにはメールボックスがあります。

関連する問題