The standard 'Alerting' feature in SharePoint allows you to only send out an alert if the item appears in a specified view.
I'm wanting to apply similar logic in a custom workflow (c#).
Given a SPListItem and SPView/SPQuery does anybody know if there is an effective* way to see if the item falls into that view / matches the query?
*effective meaning, not just running the query then looping through to find the item
I've had an idea however, if I adapt the idea discussed in the answer to this question How to query the SPView object.
If I modify the query to execute all the filters from the view, but also add in a clause where ID equals the ID of my item, I will either get 1 result back or 0, then I can just check the count.
Performance wise I'm not sure which is more efficient between Mathieu's suggestion and this idea?
I will investigate tomorrow...
UPDATE My technique was effective. I would like to think (from a design point of view) that the ID check occurring on the DB side rather than via an XML query, would be more efficient.
Thanks all the same for your suggestion Mathieu.