0 out of 1 rated this helpful - Rate this topic

UserProfile.PublicUrl Property

This member overrides ProfileBase.PublicUrl.

Namespace:  Microsoft.Office.Server.UserProfiles
Assembly:  Microsoft.Office.Server.UserProfiles (in Microsoft.Office.Server.UserProfiles.dll)
public override Uri PublicUrl { get; }

Property Value

Type: System.Uri
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Gets the MySite Url for the Current User
The follwoing code returns the Public Url for the Current User from UserProfile.

  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 Public url of the given user
  Response.Write ( u.PublicUrl.ToString() );