Showing posts with label User Profile. Show all posts
Showing posts with label User Profile. Show all posts

Wednesday, May 18, 2011

Getting the User profile

Note : Got the code while search for User profile in Net. I have changed only the Red Line because the code I got, was getting the context as null.
 
 
 
 
private UserProfile GetUserInfo(string AccountName)
{
UserProfile profile = null;
SPServiceContext serviceContext = SPServiceContext.GetContext(SPContext.Current.Site);
UserProfileManager profileManager = new UserProfileManager(serviceContext);
if (AccountName != string.Empty)
{
profile = profileManager.GetUserProfile(AccountName);
}
else
{
profile = profileManager.GetUserProfile(SPContext.Current.Web.CurrentUser.RawSid);
}
return profile;
}
 
 
Sharepoint Smoking..........
Dharani