UserProfile.PersonalUrl Property
Gets the personal URL of the user.
Assembly: Microsoft.Office.Server.UserProfiles (in Microsoft.Office.Server.UserProfiles.dll)
PersonalUrl property member gets the MYSite Personal Site Url of the User(ie., Site Collection created for the particular user) from User Profile. If the Personal Site is not available for the user, this proerpty returns the same value as Public Url.
SPSite _site = SPContext.Current.Site;
SPServiceContext context = SPServiceContext.GetContext(_site);
UserProfileManager profileManager = new UserProfileManager(context);
//Get the Current User Login Name
string UAccount = SPContext.Current.Web.CurrentUser.LoginName;
//Pass the Login Name to Profile Manager to get the properties for the User Profile
UserProfile u = profileManager.GetUserProfile(UAccount);
//PersonalUrl property gets the MySite Personal url of the given user
Response.Write ( u.PersonalUrl.ToString() );
- 11/29/2011
- Shantha Kumar
- 11/29/2011
- Shantha Kumar