I know that it is possible to write an event receiver to check the constraint but then how can I show a notification / message to the user?
Thanks for sharing your experience and knowledge.
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.Sign up to join this community
You will have to use SPEventPropertiesBase.RedirectUrl and redirect to a different url to show the error. You can then make a custom way to display the error, possibly using a querystring or some other method.
Best option as far as I know
Just create an event receiver for add Item which checks list item every time any item is added and once list items get above limit you can deny user from adding any more items.
However you can look at this question for redirecting in event receiver
I believe if the constrains evaluate to false, you will cancel that event. If that is the case then you can use the below code:
properties.Cancel = true; properties.Status = SPEventReceiverStatus.CancelWithRedirectUrl; properties.RedirectUrl = "/_layouts/EventReceiverProject1/CustomErrorPage.aspx?Error=" + errorMessage;
You can find the complete code here
Hope this helps