none
How to a search item in all folders using ews managed api RRS feed

  • Question

  • Hi Guys,

    I want to how to search item in all folders using ItemId via EWS call. i am using below code(EWS API 2.0 latest)

                     ItemView view = new ItemView(10);

                    SearchFilter searchFilter = new SearchFilter.IsEqualTo(ItemSchema.Id, "AAMkAGJjZDdiZTg4LWE0NG6+HHHfHAAAncafvAAA=");

                    
                    view.Traversal = ItemTraversal.Shallow;

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

    is works for only to search inbox. But i want to search all folders in single call.

    If anybody knows, please let me know.

    Thanks in advance

    Regards,

    Ravi Nalla

    Hewlett-Packard


    ravinalla

    Monday, May 6, 2013 6:30 AM

All replies

  • If you have the ItemId you don't need to search for the Item you can just bind to the Item directly. eg

    EmailMessage email = EmailMessage.Bind(service,new ItemId("AAMkAGJjZDdiZTg4LWE0NG6+HHHfHAAAncafvAAA="));

    The only EWS operation that would allow you to search all folders in one operation is eDiscovery which is only supported on Exchange 2013.

    Cheers
    Glen

    Monday, May 6, 2013 7:05 AM
  • Hi Glen,

    thanks for the reply. After binding email with object(email), will that give all properties along with custom properties?

    Regrds,

    Ravi Nalla

    Hewlett-Packard


    ravinalla

    Tuesday, May 7, 2013 3:57 AM
  • By default if you don't specify a propertyset in the overload of Bind it will return the firstclass properties on an Item.

    There are no operations in EWS that will return all the properties on an Item, EWS will return what you ask it to return. So if you want to return custom properties you need to define every property you want returned, added them to a property set and include the propertyset in the Bind Or Load method see http://msdn.microsoft.com/en-us/library/exchange/dd633691(v=exchg.80).aspx.

    Cheers
    Glen

    Tuesday, May 7, 2013 6:44 AM