1

I want to know under which account does code present in web parts, user controls, timer jobs, JSOM on masterpage run?

2 Answers 2

3

-Web Part: Code executes as the user logged in. Runs in w3wp.exe (worker process)

-User Control: Code executes as the user logged in. Runs in w3wp.exe (worker process)

-JSOM: Code executes as the user logged in to the workstation (since it's client side). Runs in the browser process.

-Timer job: Code executes as the SharePoint Farm Account or simply the user which runs OWSTimer Service. Runs in OWSTIMER.EXE (the SharePoint timer service).

Exceptions for web part, user control and (technically) the timer job: If a block of code is executed in the scope of RunWithElevatedPrivileges or (better) impersonation via the use of the SPUserToken of another account (e.g. System Account, your co-worker's account, etc.).

5
  • 1
    Timer job runs under SharePoint Farm Account or the user which runs OWSTimer service. Not necessarily system account. Commented Apr 9, 2014 at 5:41
  • Good catch - it's getting too late where I'm at. I really did mean to say farm account instead of system account :) Commented Apr 9, 2014 at 5:43
  • can you update your answer, as I have marked it as answer
    – variable
    Commented Apr 9, 2014 at 5:44
  • @variable answer updated Commented Apr 9, 2014 at 5:45
  • can you also update your answer to mention the processname under which the things run (w3p or OWSTimer), please
    – variable
    Commented Apr 10, 2014 at 6:42
4

AFAIK.. Web Parts, User Controls and JSOM either on MasterPage or any page uses the current logged in user credentials until you run the code under RunWithElevatedPrivileges which uses Application Pool identity..

However timer jobs run under SharePoint farm account or simply the user which runs OWSTimer service.

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.