ews-java-api icon indicating copy to clipboard operation
ews-java-api copied to clipboard

Problem in Search Folders Created from EWS using Category Criteria

Open bah7303 opened this issue 11 years ago • 3 comments

I am trying to create a Search Folder from EWS that has a Category as the Search Criteria. I can create the search folder but they do not actually contain the expected Categorized email items. If I create the folder from Outlook it works just fine. Below is the code I am using to create the Search Folder:

SearchFolder searchFolder = new SearchFolder(userDetail.getExchangeService());

    FolderView searchFolderView = new FolderView(10);
    searchFolderView.setPropertySet(new PropertySet(FolderSchema.Id,
            FolderSchema.DisplayName, FolderSchema.TotalCount));
    searchFolderView.setTraversal(FolderTraversal.Deep);

    SearchFolderParameters searchFolderParameters = searchFolder.getSearchParameters();


    SearchFilter.SearchFilterCollection searchFilterCollection = new SearchFilter.SearchFilterCollection(
            LogicalOperator.Or);

    // Add the first search filter  
    searchFilterCollection.add(new SearchFilter.IsEqualTo(
        ItemSchema.Categories, "MyCategory"));      

    searchFolderParameters.setSearchFilter(searchFilterCollection);
    searchFolderParameters.setTraversal(SearchFolderTraversal.Deep);

    FolderIdCollection folderIdCollection  = searchFolderParameters.getRootFolderIds();
    folderIdCollection.add(WellKnownFolderName.Inbox);
    folderIdCollection.add(WellKnownFolderName.SentItems);

     searchFolder.setDisplayName("SpectraSyncSearch"); 
      searchFolder.save(WellKnownFolderName.SearchFolders);

bah7303 avatar May 20 '15 16:05 bah7303

Works for me. Are you sure the given E-Mail also equals the given Category? Maybe try some other SearchFilter for testing of the behavior.

closed due to this seams to be no api error

serious6 avatar May 20 '15 17:05 serious6

Thanks for the reply. Couple of quick follow ups questions. From outlook Can you see the criteria for the search folder you created via EWS? Are you using the standard 1.2 Java EWS api?

Burke

Sent from my iPhone

On May 20, 2015, at 10:10 AM, André Behrens <[email protected]mailto:[email protected]> wrote:

Works for me. Are you sure the given E-Mail also equals the given Category? Maybe try some other SearchFilter for testing of the behavior.

— Reply to this email directly or view it on GitHubhttps://github.com/OfficeDev/ews-java-api/issues/330#issuecomment-103964013.

This message may contain information that is confidential or privileged. If you are not the intended recipient, please advise the sender immediately and delete this message. See http://www.blackrock.com/corporate/en-us/compliance/email-disclaimers for further information. Please refer to http://www.blackrock.com/corporate/en-us/compliance/privacy-policy for more information about BlackRock’s Privacy Policy.

For a list of BlackRock's office addresses worldwide, see http://www.blackrock.com/corporate/en-us/about-us/contacts-locations.

© 2014 BlackRock, Inc. All rights reserved.

bah7303 avatar May 20 '15 17:05 bah7303

I assumed you where using the latest snapshot version (which I did). For details on Outlook maybe see this article:

  • https://support.microsoft.com/de-de/kb/307922/en-us

serious6 avatar May 20 '15 17:05 serious6