1
votes

I would like to utilize some of the social collaboration features in Sharepoint 2010, such as the Noteboard webpart and tagging, but do not want to use the My Site profile pages.

I have already built a custom control that redirects from the userdisp.aspx page to a custom user profile page. I would like to continue to use that custom profile page. However, it seems like user profile links that are generated by the Noteboard webpart, for example, go directly to the /Sites/MySites/person.aspx page without being routed through the /_layouts/userdisp.aspx page. So my profile redirect control doesn't catch it.

In Sharepoint Central Admin, under Manage Service Applications > User Profile Service Application > Manage User Permissions, I have only checked the box for "Use Social Features", not "Create Personal Site," so I am not sure why the profile page is not linking to the old userdisp.aspx page.

Is it possible to redirect these links back to the userdisp.aspx page?

1

1 Answers

1
votes

It appears to be hardcoded into the webpart.

I looked at Microsoft.SharePoint.Portal.WebControls.SocialCommentControl and the link comes from UserProfile.PublicUrl, which is defined as:

public override Uri PublicUrl
{
  get
  {
    string userProfileUrl = UserProfileGlobal.GetUserProfileURL(
        this.m_objManager.UserProfileApplicationProxy, 
        this.m_objManager.PartitionID, 
        "?accountname=", 
        this.m_UserProfileFields["AccountName"].ToString());
    if (!string.IsNullOrEmpty(userProfileUrl))
      return new Uri(userProfileUrl);
    else
      return (Uri) null;
  }
}

which eventually calls:

internal static string GetUserProfileURL(string profileWebUrl, string strIdentifier, string strValue)
{
  if (string.IsNullOrEmpty(profileWebUrl))
    return (string) null;
  else
    return PersonalSpaceGlobal.EnsureTrailingSlash(profileWebUrl) 
        + "Person.aspx" 
        + strIdentifier 
        + (strIdentifier.Equals("?accountname=", StringComparison.OrdinalIgnoreCase) 
            ? SPHttpUtility.UrlKeyValueEncode(strValue).Replace(":", "%3A") 
            : SPHttpUtility.UrlKeyValueEncode(strValue));
}   

I can think of two workarounds:

  1. Add jQuery to your page to change the URL (selector = span.socialcomment-username > a)
  2. Create your own webpart containing a custom control that inherits from SocialCommentControl, which overrides RenderComment.

Overriding RenderComment is probably going to be messy. You will need to copy the decompiled code for the method just to change the following into your own code:

SocialCommentControl._GetProperty(
    comment, 
    SocialCommentControl.SocialCommentProperty.PublicPage)

Hopefully, there are no internal method calls within RenderComment's 67 lines of code. Otherwise, it is going to be a lot more difficult to implement. It would be a lot easier if you could simply override _GetProperty, but unfortunately, it is a static method.

All of that to say, I would probably recommend the jQuery option over extending SocialCommentControl.