private String getUserImage(String uname){
SPUserToken userToken = SPContext.Current.Site.SystemAccount.UserToken;
using (SPSite site = new SPSite("http://someurl.com", userToken)){
try
{
SPServiceContext serviceContext = SPServiceContext.GetContext(site);
Microsoft.Office.Server.UserProfiles.UserProfileManager upm = new Microsoft.Office.Server.UserProfiles.UserProfileManager(serviceContext);
Microsoft.Office.Server.UserProfiles.UserProfile u = upm.GetUserProfile(uname.Trim().ToString());
String ur = u.GetProfileValueCollection("PictureURL").ToString();
return ur;
}
catch (Exception) {
return "";
}
}
}
This blog is to share my some sharepoint 2010 experience with you. very recently i have to contribute new sharepoint 2010 project n i hav learn a lot from that project, most of the source code in this blog are used in project.
Sunday, January 15, 2012
How to get user profile image - sharepoint 2010
There are many way to get user profile image.Here is a one of these methods.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment