Wish a very Merry Christmas for everyone!
I have Outlook addin, that should track some particular threads in user's mailbox.
It has collection of Conversation Ids, and uses FindItem operation for searching related items.
I'm puzzled - how make EWS API returning only the latest message for each conversation?
Currently I'm using EWS request like this:
<m:FindItem Traversal="Shallow">
<m:ItemShape>
<t:BaseShape>IdOnly</t:BaseShape>
... some props ...
</m:ItemShape>
<m:Restriction>
<t:And>
<t:Exists>
/* all tracked messages are flagged with Custom properties */
<t:ExtendedFieldURI DistinguishedPropertySetId="PublicStrings" PropertyName="cecp-{ADD_IN_ID}" PropertyType="String" />
</t:Exists>
<t:Or>
<t:IsEqualTo>
<t:FieldURI FieldURI="item:ConversationId"/>
<t:FieldURIOrConstant>
<t:Constant Value="{ConversationId}" />
</t:FieldURIOrConstant>
</t:IsEqualTo>
... thousands or even billions of Conversation ids ...
</t:Or>
</t:And>
</m:Restriction>
<m:ParentFolderIds>
<t:DistinguishedFolderId Id="sentitems" />
</m:ParentFolderIds>
</m:FindItem>
I also thought about results grouping (using <GroupBy />), but it seems has no possibilities to have just one item per group (I have no idea how to make such request at least)
Thanks.