Search code examples
c#.net.net-coreexchangewebservices

EWS Find Items by PR_SEARCH_KEY


I managed to get the PR_SEARCH_KEY from some email items as described in PR_SEARCH_KEY using EWS but now I wonder how I can search items with this key in C# (.net-core).

Cheers Christoph


Solution

  • You need to convert the HexValue you have back to a Binary and then to Base64 and you can then use it in a SearchFilter when searching a foldereg

            ExtendedPropertyDefinition eDef = new ExtendedPropertyDefinition(0x300B, MapiPropertyType.Binary);    
            ItemView iv = new ItemView(1000);
            SearchFilter sf = new SearchFilter.IsEqualTo(eDef ,Convert.ToBase64String(searchval));
            FindItemsResults<Item> fiItems = Folder.FindItems(sf, iv);