The easiest way using code is an event receiver that checks the item count.

Something like this:

using Microsoft.SharePoint;

namespace ItemLimitEventHandler
{
    public class Class1 : SPItemEventReceiver
    {
        public override void ItemAdding(SPItemEventProperties properties)
        {
            if (properties.OpenWeb().Lists[properties.ListId].ItemCount > 20)
            {
                properties.Cancel = true;
                properties.ErrorMessage = "There are already 20 items in this 
list.";
            }
            base.ItemAdding(properties);
        }
    }
}

For more information about event receivers, see my blog 
(www.sharepoint-tips.com<http://www.sharepoint-tips.com>) ,but it is basically 
just a class library (sign, and put in GAC or bin). To register the event 
receiver on an existing library, either use a feature, or code, or my utility 
pack 
(www.codeplex.com/spstipsutilitypack<http://www.codeplex.com/spstipsutilitypack>)

That is the simple way.
The complex way is to develop a custom policy...but you wanted simple.


From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Milliner
Sent: Thursday, 11 September 2008 1:34 PM
To: [email protected]
Subject: RE: [OzMOSS] RE: limit number of entries in a list.

I have SharePoint designer and can get access to have Visual Studio 
installed... I am just looking at the easiest path... as I have not had that 
much experience with Visual Studio..

Regards
Peter

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ishai Sagi
Sent: Thursday, 11 September 2008 1:31 PM
To: [email protected]
Subject: [OzMOSS] RE: limit number of entries in a list.

So...no sharepoint designer, and no visual studio, implement a list item limit 
on a list?

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Peter Milliner
Sent: Thursday, 11 September 2008 1:19 PM
To: [email protected]
Subject: [OzMOSS] limit number of entries in a list.

 Hello all,

Firstly thanks for all the advice on Server Farm configuration.  Another quick 
question as I am not technically a developer but due to having to adapt in a 
small workplace - I have had to dabble in just about everything ....SharePoint 
Designer and Visual Studio, Server setup etc etc....

What I need to know is that is there a way to set the number of items allowed 
in a list (not displayed i.e. It would only allow 20 items to be inputted) 
without any customisation through designer and and if so how? if not can anyone 
advise me on how I could achieve this?

Regards
Peter Milliner
Bendigo TAFE
------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.
Powered by mailenable.com
------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.
Powered by mailenable.com
------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.
Powered by mailenable.com



------------------------------------------------------------------- OzMOSS.com 
- to unsubscribe from this list, send a message back to the list with 
'unsubscribe' as the subject.

Powered by mailenable.com

Reply via email to