在Sharepoint 2010中禁用“我的网站”配置文件的链接

时间:2012-01-26 00:54:55

标签: sharepoint-2010

我想利用Sharepoint 2010中的一些社交协作功能,例如Noteboard webpart和标记,但不想使用“我的网站”配置文件页面。

我已经构建了一个自定义控件,可以从userdisp.aspx页面重定向到自定义用户配置文件页面。我想继续使用该自定义配置文件页面。但是,例如,Noteboard webpart生成的用户配置文件链接似乎直接转到/Sites/MySites/person.aspx页面,而不通过/_layouts/userdisp.aspx页面进行路由。所以我的配置文件重定向控件无法捕获它。

在Sharepoint Central Admin中,在“管理服务应用程序”下>用户简档服务应用程序>管理用户权限,我只选中了“使用社交功能”,而不是“创建个人网站”,因此我不确定为什么配置文件页面没有链接到旧的userdisp.aspx页面。

是否可以将这些链接重定向回userdisp.aspx页面?

1 个答案:

答案 0 :(得分:1)

它似乎被硬编码到webpart中。

我在looked Microsoft.SharePoint.Portal.WebControls.SocialCommentControl,该链接来自UserProfile.PublicUrl,其定义为:

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;
  }
}

最终调用:

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));
}   

我可以想到两个解决方法:

  1. 将jQuery添加到您的页面以更改网址(selector = span.socialcomment-username> a)
  2. 创建您自己的webpart,其中包含一个继承自SocialCommentControl的自定义控件,该控件将覆盖RenderComment
  3. 重写RenderComment可能会变得混乱。您需要复制方法的decompiled代码才能将以下内容更改为您自己的代码:

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

    希望RenderComment的67行代码中没有内部方法调用。否则,实施起来会更加困难。如果您可以简单地覆盖_GetProperty,那将会容易得多,但不幸的是,它是一种静态方法。

    所有这些都说,我可能会建议使用jQuery选项来扩展SocialCommentControl。

相关问题