2014-02-24 1 views

답변

4

당신이 마이크로 소프트에 의해 생성 된 라이브러리를 의미 가정하면, 여기 예제는 에서 바로이 다운로드에 포함 EWS 자바 API.rtf 시작하기 :

public void findItems() 
{ 
ItemView view = new ItemView(10); 
view.getOrderBy().add(ItemSchema.DateTimeReceived, SortDirection.Ascending); 
view.setPropertySet(new PropertySet(BasePropertySet.IdOnly, ItemSchema.Subject, 
     ItemSchema.DateTimeReceived)); 


FindItemsResults<Item> findResults = service.findItems(WellKnownFolderName.Inbox, new SearchFilter.SearchFilterCollection(
LogicalOperator.Or, new SearchFilter.ContainsSubstring(ItemSchema.Subject, "EWS"), 
new SearchFilter.ContainsSubstring(ItemSchema.Subject, "API")),view); 

System.out.println("Total number of items found: " + findResults.getTotalCount()); 

for (Item item : findResults) 
    { 
      System.out.println(item.getSubject()); 
      System.out.println(item.getBody()); 
      // Do something with the item. 
    } 
} 
+0

이 도움을 잘 .. 감사하고있다 . 대소 문자를 구분하지 않으려 고 노력하고 있지만. pls 알고있는 경우 알려 주시기 바랍니다. –

+0

안녕하세요, findItems() 메소드를 사용할 때 항목을 정렬하는 데 문제가 있습니다. 이전 답변에서 사용하는 방법은 작동합니까? – Marin

+0

제목 줄에 ÿ 등의 특수 문자가있는 경우 찾기 항목은 아무 것도 검색하지 않습니다. – Lucky

관련 문제