Pages

Sunday, June 21, 2015

Get Current Loggin User in SharePoint Programmatically

Get current user using SharePoint SPControl class.

private SPUser GetLoginUser()
{
    SPUser currentUser = null;
    try
    {
        currentUser = SPControl.GetContextWeb(Context).CurrentUser;
    }
    catch (Exception)
    {
        throw;
    }
    return currentUser;
}

No comments:

Post a Comment