Question

I have a custom list in my sharepoint 2010 site. I want to set a limit to the list, that after reaching the limit(say 10 items), no one can add any more items to that list. how it can be done.. please tell me how to do it.

Thanks in advance.

Was it helpful?

Solution

I dont think this can be achieve OOTB features of sharepoint .

But i may be possible with the use of some programming

You can use event receiver to achieve this.

  1. When an Item is adding in the list check foe the count of a list
  2. if count is 10 then cancel the event.

public override void ItemAdding(SPItemEventProperties properties)
{
SPWeb web = properties.OpenWeb();
SPList list = web.Lists[properties.ListId];
if (list.ItemCount == 10)
{
properties.Cancel = true;
}
else
{
base.ItemAdding(properties);
}
}

Hope this helps

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top