Apr 6, 2010

How to get the logged in user name in Sharepoint site using javascript

Place a asp login control in Master page and give id(here im giving id as LoginCtrl)

Open your site in sharepoint designer and select the masterpage.Select a placeholder(for eg PlaceHolderTitleAreaClass)and place the Asp.Net LoginName control by selecting Insert tab from Menu.

Insert-->ASP.Net controls-->More Asp.NetControls select LoginName control from Login categroy.(If u want to make invisible assign proprty visible='false').

In your page get it by writing javscript:

var sLoginUserName ="";


sLoginUserName =document.getElementById('ctl00_LoginCtrl').innerText; //IE

1 comment: