Hi swapna_l9
You can create a web part which can get the login user name and add this web part to the newform.aspx. You can get user info by writing code like this:
SPContext currentContext=SPContext.Current;
string uName=string.Empty;
if (currentContext != null && currentContext.Web.CurrentUser != null)
{
SPWeb web = SPControl.GetContextWeb(currentContext);
uName = web.CurrentUser.LoginName;
}
else
{
uName = System.Web.HttpContext.Current.User.Identity.Name;
}
After writing the web part, you can add querystring toolpaneview=2 to the newform.aspx url like this:
http://sitename/Lists/Tasks/NewForm.aspx?RootFolder=%2FLists%2FTasks&source=http%3A//lambda2007/default.aspx&toolpaneview=2
to add the new web part.
You can either use JQuery to send an ajax request to the url
http://sitename/_layouts/userdisp.aspx?Force=True, and use Regex to search the information you need about the user.
RegExp("FieldInternalName=\"" + “Name” + "\"", "gi")
Hope that helps,
Thanks.
Lambda Zhao
TechNet Community Support
