Вопрос

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.

Это было полезно?

Решение

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

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top