Showing posts with label Getting user full name from Login information in MOSS. Show all posts
Showing posts with label Getting user full name from Login information in MOSS. Show all posts

Wednesday, 2 April 2008

Getting user full name from Login information in MOSS

using Microsoft.SharePoint;
using Microsoft.SharePoint.Administration;
using Microsoft.Office.Server.UserProfiles;
using Microsoft.Office.Server;





SPSite _site = new SPSite("http://server/");
ServerContext scontext = ServerContext.GetContext(_site);
SPUser memb = _site.OpenWeb().CurrentUser;
UserProfileManager upm = new UserProfileManager(scontext);
UserProfile up = upm.GetUserProfile(memb.LoginName);
MessageBox.Show(up["FirstName"].ToString() + up["LastName"].ToString());




Hope this will help.

we can get from Active directory also.

In this we are accessing only sharepoint user profile store