tags:

views:

225

answers:

1

Hello,

I wonder if there is a way to create a Custom List in Sharepoint, but specify that each user may only create one item in the list.

I am thinking of two approaches:

  • Develop a ListReceiver that checks if the user already created an item. Problem: I did not see a way to enable a Feature on a specific list (the idea is that non-developers can just create a custom list and "switch on" the Feature if they want
  • Create a Custom List Type, so when people click the "Create" Button, they see "Custom Unique List" under "Custom Lists" as an additional type.

Before I do the second option, does anyone know if the first option is possible? Or even if it can already be done without custom development (and without a custom workflow in SPDesigner)

+4  A: 

Hello,

Without custom code you are out of luck. You can easily add a receiver to a single list using code, just add the receiver to the SPListItem.EventReceivers collection as such:

list.EventReceivers.Add(SPEventReceiverType.ItemAdded, "YOUR STRONG NAME", "YOUR CLASS NAME");

There is no way directly through a feature elements file, however.

If you want an option to enable or disable the feature on a particular list you can also add a CustomAction and bind it to that specific list template for instance so that an extra Action menu item allows Enable or Disable Unique Posts.

.b

Bjørn Furuknap
Custom List Actions, totally forgot about them. A custom action to enable/disable the EventReceiver sounds like the best solution. Thanks!
Michael Stum