Pages

Showing posts with label Context. Show all posts
Showing posts with label Context. Show all posts

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;
}