For one of my current project I am working on following requirement,
Whenever a User Opens any item in SharePoint List on edit form, display form, I want to check if the item being opened satisfies the default view filter conditions for that list. I want to implement this requirement to ensure that user not having rights on any item (as per the default view filters) should not be able to open the item by directly putting id in URL.
I have tried below options for this,
OPTION 1 Get CAML query of List View, add an AND condition for specific item ID being opened and check if it satisfies condition.
But, it is not performance efficient it takes a lot of time for query to execute.
OPTION 2 (actual solution is required for this option)
I want to simply query an item from list by id. and then when it is returned from SharePoint, I want to dynamically check if it satisfies CAML query condition.
Any help would be highly appreciated.