I'm currently trying to create a custom web part to display list items in an easy to read format. This web part essentially uses the REST API to grab the items and put them into a nicely formatted HTML list on the left hand side of a page. Upon clicking an item, it will then populate the right hand side of the page with the information for that specific item.
The second list is used for storing when users have "read" the above list items. When an item on the left hand side is clicked, an API call is made to add an item to this second list, signifying that the user has read that item (if they haven't read it before). Unread items are then displayed in bold while read items are not, so users can see what has already been read. It is important that users read these articles, hence the need for read tracking.
So the lists are laid out as follows:
Article list (main list that is used for the items): ID Title (Summary of info) Text (Main body of info) Author (Author of info)
Article Read Tracking list: ArticleID (the ID of the item in the article list to link which article has been read) User (email address of the user as single line of text) ReadTimeStamp (the time the item was read by the user)
The User and ArticleID columns in the read list are indexed.
How the page currently works is I get the top 100 items, paginated and descending by ID. I then get the top 100 read items, paginated, descending by ArticleID and filtered to the currently logged in user's email address, so that the read items match the ID of the 100 articles collected previously.
This all works fine until a user has created over 5000 items in the read tracking list, as the filter on user in the read list starts throwing a threshold exceeded error.
My main issue is that I am unable to just get the top x items from the read list and then filter, as it may miss out read items from the top 100 article items, depending on how many other users read those 100 items. For example, if 100 users read 100 items, that's 10,000 items, meaning the currently logged in user will only get 50 of their 100 read items.
However, if I try to $filter=User it throws the exceed error because it's finding over 5000 items, even if I use the $top to try and limit it to 100.
Is there a way around this? I feel like I'm missing something but I'm not sure what.
This post is a bit of an information dump, but hopefully it makes enough sense!
Any help would be greatly appreciated.