Sunday, January 15, 2012

How to get user profile in sharepoint 2010


                UserProfileManager pm = new UserProfileManager(SPServiceContext.Current);
                UserProfile currentUserProfile = pm.GetUserProfile(loginName);
                String mySiteURL= currentUserProfile.PersonalUrl.ToString();


                SPSite site = new SPSite("http://someurl.com");
                ServerContext context = ServerContext.GetContext(site);
                UserProfileManager profileManager = new UserProfileManager(context);
                UserProfile currentUserProfile = profileManager.GetUserProfile(loginName); 


No comments:

Post a Comment