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

2 Answers 2


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:




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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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