0
PropertySet itempropertyset = new PropertySet(BasePropertySet.FirstClassProperties);
itempropertyset.setRequestedBodyType(BodyType.Text);
ItemView view = new ItemView(10);
view.getOrderBy().add(ItemSchema.DateTimeReceived, SortDirection.Descending);
view.setPropertySet(new PropertySet(BasePropertySet.IdOnly, ItemSchema.Subject, ItemSchema.DateTimeReceived));
SearchFilter searchFilter = new SearchFilter.SearchFilterCollection(LogicalOperator.Or, new SearchFilter.IsEqualTo(EmailMessageSchema.IsRead, false));
FindItemsResults<Item> findResults = service.findItems(WellKnownFolderName.Inbox, searchFilter, view);
service.loadPropertiesForItems(findResults, itempropertyset);
System.out.println("Total number of items found: " + findResults.getTotalCount());
for (Item item : findResults) {
System.out.println(item.getSubject());
System.out.println(item.getBody());
}
現在、私の取引所に接続していますが、未読メールを読み込んで添付ファイルを取得する必要があります。EWS Java Api検索フィルターが無視されました
検索フィルタは機能しませんが、Operator
をORからORに変更できます。SortDirection
を昇順から降順に変更できますが、違いはありません。私の検索フィルターは現在未読に設定されていますが、ランダムなメールが戻ってきます。 ItemViewは10に設定されていますが、157の電子メールを返します。 printlnから
:私が間違ってやっているのTotal number of items found: 157
任意の提案ですか? 親切に受け入れる