Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9186133
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:26:58+00:00 2026-06-17T19:26:58+00:00

Am trying to find the current logged user in sharepoint site workflow 2010 while

  • 0

Am trying to find the current logged user in sharepoint site workflow 2010 while creating a project. Based on the user, I would like to retrieve the current user’s project manager. Every time am trying to retrieve current user name, it’s giving System Account.

I even tried logging in as different user but still displaying System Account as the current user.

I tried following options :

SPUser user = workflowProperties.OriginatorUser;

SPUser user = SPContext.Current.Web.CurrentUser;


SPWeb web = SPContext.Current.Web;
SPUser user = web.CurrentUser;

 SPContext.Current.Web.CurrentUser.LoginName;

But everything failed. Am sure that am doing something wrong. I don’t know the correct procedure. Some procedures give me null or Object reference not set to an instance of the object or System Account details. I have even tried using elevated permission and its giving me null value.

SPSecurity.CodeToRunElevated elevatedSubmit = new SPSecurity.CodeToRunElevated(delegate
        {
            //SPUser user = SPContext.Current.Web.CurrentUser;
            //string strAssignedTo = user.Name;

            string sspURL = "http://localhost/PWA/default.aspx";
            SPSite site = new SPSite(sspURL);
            SPWeb web = site.OpenWeb();
            SPUser theUser = web.CurrentUser;
            string strUserName = theUser.Name;
        });

        SPSecurity.RunWithElevatedPrivileges(elevatedSubmit);

Am I supposed to add users explicitly as SPUser or any other changes before trying to retrieve current user via workflow ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:26:59+00:00Added an answer on June 17, 2026 at 7:26 pm

    SharePoint 2010 Get Current Username / Logged in User

    check this StackExchange answer as well
    Get the current user interacting with a site workflow

    if you are wanting to get the current user when you log in you can try something like this

    SPWeb webSite = SPControl.GetContextWeb(SPContext);
    SPUser spUser = webSite.CurrentUser;
    string strUserName = spUser.LoginName;
    

    using this line below will return the OriginatorUser however if you are not logged in as Admin you will get the System Account UserName

    //This give the Login name e.g <domain>\<name>  
    workflowProperties.OriginatorUser.LoginName;
    

    ** Note ** I noticed that in your code you are trying to get / assign user twice
    you should only need this line if you decide to use your code

    SPUser user = SPContext.Current.Web.CurrentUser;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to find out current user name for my sharepoint application. There are
I am trying to find my current location for an android project. When the
I'm trying to set the current user into a variable to display Logged in
Im trying to find the current cell that the user has clicked on. For
I am trying to find records based on the current date. One of the
I am trying to find current location, and this is my code. LocationManager mlocManager
I'm trying to find a good, current css3 gradient reference, including vendor prefixes. I've
I am trying to find the current caret position (the blinking |) in x
I'm trying to create a plugin, that uses chrome.tabs.getSelected to find current URL, Below
Im having a mysql problem, I am trying to find the most current value

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.