Custom Profile Properties don't display in userdisp.aspx

I have added some custom profile properties per the following KB article: How do I gather custom data from users when they register for site access?.  I have added FirstName, LastName, PhoneNumber, and Company.  The problem is that when users click on a user (from a Modified By field for example) to view their properties, they are navigated to userdisp.aspx, which does not display the custom fields.  My question is how would I get userdisp.aspx to display the custom properties configured for Extranet Collaboration Manager?  Or, is that even possible?

Have more questions? Submit a request

5 Comments

  • 0
    Avatar
    Matthew McBride

    There is no out-of-the-box solution for this issue. You will need to modify the userdisp.aspx page and add the a control to display the custom properties. This issue stems from the fact that Microsoft doesn't treat FBA data as a first class citizen like AD. We are hopeful the next version/service pack will provide FBA profile synchronization.

  • 0
    Avatar
    Matthew McBride

    Can you post an example, or provide any other guidance?  And by "next version", do you mean the next version/SP for WSS or for ExCM?

     Thanks

  • 0
    Avatar
    Matthew McBride

    The next version referred to would most likely be SharePoint's including FBA profile information in this page.

    In the meantime, you can override the default control template used to create the user info form. If you look in the userdisp.aspx file you see the following control -

    <

    SharePoint:FormComponent id="UserListForm" TemplateName="UserListForm" ControlMode="Display" runat="server"/>

    The template mentioned for the control is UserListForm and is found in the file C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\CONTROLTEMPLATES\DefaultTemplates.ascx.

    The file C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\LAYOUTS\SPSolutions\Delegation\MangProfilePage.aspx uses the same FormComponent control to display the profile info using the template defined in the file ..\12\TEMPLATE\CONTROLTEMPLATES\DelegationProfilePropertiesControl.ascx.

     Using the layouts in both of these files you can override the form using the following MSDN article as a reference. You will need to add code in a <script runat="server"></script> block to populate the controls from the layout in DelegationProfilePropertiesControl.ascx.

    http://msdn.microsoft.com/en-us/library/aa544582.aspx

  • 0
    Avatar
    Matthew McBride

    HI,

    i face the same problem, i went to user profiles and added new fields, and when i visit My Site i found the new added properties, but when i went to My Settings (userdisp.aspx) i did not find the reflected data?! is the post above will solve this issue, and if yes, can you please give me more details.

     

    Thanks Alot 

  • 0
    Avatar
    Matthew McBride

    The previously mentioned method of overriding the FormComponent's default template will allow you to see the profile information on the userdisp.aspx page.

     Essentially, our custom page MangProfile.aspx uses the same FormComponent control but with a custom template. Below is an example of using our template to change the profile information shown by userdisp.aspx. It replaces the entire contents of userdisp.aspx. It is meant as an example only and can be used as a starting point if you wish to customize it further. SharePoint Solutions cannot support this code and cannot be responsible for its suitability in your environment.

    <%

    @ Assembly Name="Microsoft.SharePoint.ApplicationPages, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"%>
    <%@ Page Language="C#" Inherits="Microsoft.SharePoint.ApplicationPages.UserDisplayPage" MasterPageFile="~/_layouts/application.master" %>
    <%
    @ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
    <%
    @ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%
    @ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%
    @ Import Namespace="Microsoft.SharePoint" %>
    <%
    @ Assembly Name="SPSolutions.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=08a33cc09f006379"%>
    <%
    @ Assembly Name="SPSolutions.SharePoint, Version=1.0.0.0, Culture=neutral, PublicKeyToken=08a33cc09f006379"%>
    <%
    @ Assembly Name="SPSolutions.SharePoint.Delegation, Version=1.0.0.0, Culture=neutral, PublicKeyToken=08a33cc09f006379" %>
    <%
    @ Import Namespace="SPSolutions.SharePoint.Delegation.WebControls" %>
    <%
    @ Import Namespace="SPSolutions.SharePoint.Delegation" %>
    <%
    @ Import Namespace="SPSolutions.Web" %>
    <%
    @ Register TagPrefix="wssuc" TagName="InputFormSection" src="~/_controltemplates/InputFormSection.ascx" %>
    <%
    @ Register TagPrefix="wssuc" TagName="InputFormControl" src="~/_controltemplates/InputFormControl.ascx" %>
    <%
    @ Register TagPrefix="wssuc" TagName="ButtonSection" src="~/_controltemplates/ButtonSection.ascx" %>
    <%
    @ Register TagPrefix="wssuc" TagName="ToolBar" src="~/_controltemplates/ToolBar.ascx" %>
    <%
    @ Register TagPrefix="wssuc" TagName="ToolBarButton" src="~/_controltemplates/ToolBarButton.ascx" %>
    <%
    @ Register Tagprefix="wssawc" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
    <%
    @ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>

    <script runat="server">

    /// <summary>
    /// Email
    /// </summary>
    protected string Email
    {
      get { return EmailTextBox.Text; }
     
    set {
          EmailLabel.Text =
    value;
         
    EmailTextBox.Text = value;
           }
    }

    /// <summary>
    /// User name
    /// </summary>

    protected string UserName
    {
     
    get { return UserNameLabel.Text; }
     
    set { UserNameLabel.Text = value; }
    }

    /// <summary>
    /// Get the delegation profile properties control
    /// </summary>

    protected DelegationProfilePropertiesControl ProfilePropertiesControl
    {
     
    get {
         
    return SPSolutions.Web.ControlUtil.FindControl(ProfilePropertiesTemplate, "ProfileProperties") as DelegationProfilePropertiesControl;
            }
    }

    protected override void OnLoad(EventArgs e)
    {
      
    base.OnLoad(e);

      // Get selected user
     
    SPUser selectedUser = null;

     
    int userID;
      
    Int32.TryParse(this.Request.QueryString["ID"].ToString(), out userID);
     
    if (userID == null)
      {
        
    return;
      }

    // Find user's account
    foreach (SPGroup group in SPContext.Current.Web.Groups)
    {
     
    foreach (SPUser user in group.Users)
      {
         
    if (user.ID != userID)
          {
           
    continue;
          }
          selectedUser = group.Users.GetByID(userID);
          UserName = selectedUser.LoginName;
      }

      if (UserName != "")
      {
       
    break;
      }
    }

    // Make sure this is not a domain user
    if (!UserName.Contains(":"))
    {
      UserListForm.Visible =
    true;
      ProfileProviderSection.Visible =
    false;
     
    return;
    }

    // Turn off SharePoint's default profile
    UserListForm.Visible = false;

    //Get username without membership provider
    string userName = UserName.Substring(UserName.IndexOf(":") + 1, (UserName.Length - UserName.IndexOf(":") - 1));

    // Init profile control
    ProfilePropertiesControl.UserName = userName;

    // Update a few UI components
    PageTitle.Text = string.Format("User Profile - {0}", UserName);
    PageTitleInTitleArea.Text =
    string.Format("User Profile - {0}", UserName);

    // Set UserName and Email fields
    UserName = userName;
    Email = selectedUser.Email;

    // Set the control to view only
    ProfilePropertiesControl.ChangeMode(false);
    }

    /// <summary>
    /// Handle close button events
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="args"></param>
    protected void CloseButton_Click(object sender, EventArgs args)
    {
     
    SPUtility.Redirect(SPContext.Current.Web.ServerRelativeUrl, SPRedirectFlags.Default | SPRedirectFlags.UseSource, Context);
    }

    </script>

    <
    asp:Content ContentPlaceHolderId="PlaceHolderPageTitle" runat="server">
      <SharePoint:EncodedLiteral id="PageTitle" runat="server" text="<%$Resources:wss,userdisp_pagetitle%>" EncodeMethod='HtmlEncode'/>
    </
    asp:Content>
    <
    asp:Content ContentPlaceHolderId="PlaceHolderAdditionalPageHead" runat="server">
     
    <SharePoint:DelegateControl runat="server" id="DelctlProfileRedirection" ControlId="ProfileRedirection" Scope="Farm" />
    </
    asp:Content>
    <
    asp:Content ContentPlaceHolderId="PlaceHolderPageTitleInTitleArea" runat="server">
     
    <SharePoint:EncodedLiteral id="PageTitleInTitleArea" runat="server" text="<%$Resources:wss,userdisp_pagetitleintitle%>" EncodeMethod='HtmlEncode'/> <!--<asp:Label id=LabelTitle runat=server />-->
    </asp:Content>
    <
    asp:Content ContentPlaceHolderId="PlaceHolderMain" runat="server">
     
    <table cellspacing="0" cellpadding="0" visible="false">
       
    <tr>
         
    <td>
           
    <SharePoint:FormComponent id="UserListForm" TemplateName="UserListForm" ControlMode="Display" Visible="false" runat="server"/>
         
    </td>
       
    </tr>
       
    <tr>
         
    <td>
           
    <asp:Panel ID="ProfileProviderSection" Visible="true" runat="server">
             
    <table width="100%" class="propertysheet" cellpadding="0" cellspacing="0" border="0">
               
    <wssuc:InputFormSection id="GeneralSection" Title="<%$Resources:del,AddUserToAuthStore_GeneralSection_Title %>" Description="<%$Resources:del,MangProfile_GeneralSection_View_Desc %>" runat="server">
               
    <Template_InputFormControls>
                  <wssuc:InputFormControl ID="InputFormControlUserName" runat="server" LabelText="<%$Resources:del,AddUserToAuthStore_UserName_Label %>">
                   
    <Template_Control>
                     
    <asp:Label ID="UserNameLabel" Title="<%$Resources:del,AddUserToAuthStore_UserName_Title %>" class="ms-input" Columns="35" Runat="server" MaxLength=255 />
                   
    </Template_Control>
                 
    </wssuc:InputFormControl>
                 
    <wssuc:InputFormControl runat="server" LabelText="<%$Resources:del,AddUserToAuthStore_Email_Label %>">
                   
    <Template_Control>
                     
    <asp:Label ID="EmailLabel" Title="<%$Resources:del,AddUserToAuthStore_Email_Title %>" class="ms-input" Columns="35" Runat="server" MaxLength=255 />
                     
    <wssawc:InputFormTextBox Visible="false" ID="EmailTextBox" Title="<%$Resources:del,AddUserToAuthStore_Email_Title %>" class="ms-input" Columns="35" Runat="server" MaxLength=255 />
                  
    </Template_Control>
                 
    </wssuc:InputFormControl>
               
    </Template_InputFormControls>
             
    </wssuc:InputFormSection>
              
    <SharePoint:FormComponent ID="ProfilePropertiesTemplate" TemplateName="DelegationProfilePropertiesForm" ControlMode="display" Visible="true" runat="server" />
               
    <wssuc:ButtonSection ID="BottomButtonSection" ShowStandardCancelButton="false" runat="server">
                 
    <Template_Buttons>
                   
    <asp:Button ID="ButtonClose" class="ms-ButtonHeightWidth" UseSubmitBehavior="false" CausesValidation="false" Text="<%$Resources:del,Close %>" OnClick="CloseButton_Click" runat="server" />
                 
    </Template_Buttons>
               
    </wssuc:ButtonSection>
              </
    table>
            </
    asp:Panel>
           
    </td>
         
    </tr>
         
    <tr><td><IMG SRC="/_layouts/images/blank.gif" width=590 height=1 alt=""></td></tr>
       
    </table>
      </
    asp:Content>
    David Fisher
    Software Engineer
    SharePoint Solutions
Please sign in to leave a comment.