SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The reason I offer both of those languages is that I can achieve what I'm trying to accomplish using either javascript, or C#, but they are completely different languages. I couldn't find any sort of this functionality in the workflows in sharepoint designer.

share|improve this question
up vote 6 down vote accepted

The easiest way to invoke some code on submission (...insert) of a list item it to write an ItemAdded event receiver. The item level event receiver can be registered against a web, list or content type. Here's an example of registering one against a web (...this would fire for an item added to any list or library on the web:

SPEventReceiverDefinition itemAdded = web.EventReceivers.Add();
itemAdded.Type = SPEventReceiverType.ItemAdded;
itemAdded.Assembly = "MyAssemly, Version=, Culture=neutral, PublicKeyToken=141fe4b547d7494f";
itemAdded.Class = "MyClass";
itemAdded.SequenceNumber = 100;

And then the event receiver would look something like this:

public class EventReceivers : SPItemEventReceiver
    public override void ItemAdded(SPItemEventProperties properties)
       // perform ItemAdded operation
share|improve this answer
If I can just check one thing with you: Using SequenceNumbers below 10000 is not recommended because Microsoft 'reserved' them for OOTB receivers. I have heard or read about it in the past but right now I cannot find any valid information on the web (except some random forums). – Vedran Rasol Jul 30 '11 at 22:26
I've heard that before, but I'm not aware of any guidance direct from Microsoft on that. There could also conceivably be scenarios where you are doing something where it's absolutely necessary that your event receiver runs first. – Rob D'Oria Jul 31 '11 at 0:00

You could use an Event Receiver. From the article:

What is a custom event handler? A custom event handler is a .Net assembly that contains the additional business logic you need to run when the event occurs in SharePoint.

You'll probably need to implement the ItemAdding and/or ItemAdded event(s).

share|improve this answer

Javascript code can be run but utilizing the PreSaveAction() function. This will allow you to execute any javascript code you need to on the list item submission before the item is commited to the database.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.