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

I have having a situation where I have an event receiver that uses ItemUpdated event to automatically start workflow. This is causing problem when user clicks on Edit in Excel and check in items from there. Code to redirect to workflow start form is executed but since excel uses /_vti_bin/List.asmx, it raises error.

Is there any way I can detect if item is updated through UI or through service?

Thanks in advance

share|improve this question

I am able to resolve this problem. Here is how:

Add a variable to store SPContext in event receiver and assign it in constructor:

SPContext currentSPContext;

public ClassName()
  currentSPContext = SPContext.Current;

If source updates data from service you will get referrer null. You can check it by using:



share|improve this answer

You should check the user who is performing the action in item updating and set a value. If it is the service account or not.

You want to reference:


This only works for before events (Ending with a ing basically Adding, Deleting etc...)

You can't get the user from Updated.

But if the library is updated the modifiedby will be set to the value of that user, but this can perhaps not be the case for if example you have another event receiver running, it will set as the app pool account or something similar.

Hope this helps.

share|improve this answer
Thanks for the help, this isn't working as expected – Prashant Lakhlani Oct 31 '12 at 8:42

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.