0

I see all kinds of code to get current SharePoint 2010 logged in user. (I guess current context user from the browser client).

What is the best code? (not currently logged into machine user)

1
  • What is it that you are trying to do and from where? For example, the code for a web part is radically different from a powershell script which is also different from what you would use in a timer job
    – Dave Wise
    Commented Apr 19, 2012 at 16:19

1 Answer 1

0

Use SPContext.Current.Web.CurrentUser will give you the current user SPUser object (browser). To get the current user loginname use SPContext.Current.Web.CurrentUser.LoginName .

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.