I want to perform some Action once the item is added. I have a Custom List that reacts on Item Creation.
If, at this level, i want to Delete the item immediately once it is added, how could I do?
Thank you very much!
You can use sharepoint designer to create a list workflow for the list.
You can use conditions to determine if the item should be deleted.
Then you can delete the current item.
As C.Marius mentions, if you are able to add custom code, go for a Event Handler.
To point you in the right direction, check this example out;
http://msdn.microsoft.com/en-us/library/ms437502(v=office.14).aspx
But would it not be better to prevent users to add the listitem in the first place?
Anyway, the most simple approach i can think off:
Public override void ItemAdded(SPItemEventProperties properties)
{
base.ItemAdded(properties);
properties.ListItem.Delete();
properties.Cancel = true;
}
And dont forget to scope the Event Handler to the specific list in the Elements.xml, just change
<Receivers ListTemplateId="100">
to this
<Receivers ListUrl="Lists/someListName">
It will depend on the intended approach: