SharePoint 2010: Fetching Current Username Programmatically

In order to get the current login user of the selected SharePoint website we can use the following code snippet.
public string getUserName()
        {
           return SPContext.Current.Web.CurrentUser.Name;
        }
Hope this helps Cheers

Comments

Popular posts from this blog

SPFx: Develop using SharePoint Framework without Installing all the dependecies.

SharePoint Online: Elevated Permissions....with love

Powershell: Filling up an Existing Excel Sheet with data from SQL Server