locked
SharePoint 2010 + Claims + FBA + People Picker --- Can the Picker show a true Display Name and not just the ID (username)? RRS feed

  • Question

  • Turns out the 3rd party web service we are using for FBA allows users to change their usernames, but does contains a unique, numerical ID. While this ID would allow me to create unique site users, apparently the OOB Forms Claim Provider uses that same field for the display name in the People Picker.

    Needless to say if I use the ID, business user won't know who 14245 is, so I decided to try and concatinate the Full Name: <first last name> | <id>

    This allows me to show a business user who they are selcting and allows me to use the unique id to find them in my custom membership provider. However now I run into a problem where I would need to update their login names if they ever updated their first and/or last name (such as when someone gets married). Apparently updating the login name programatically is a bit of a challenge as even under elevated privledges the SPFarm.local.migrateuser won't work.

    The only other option I have read "might" work is to create my own custom Claims Provider that would be able to pass both a Display Name and an ID to the people picker control and allow me to use the unique, numerical ID as the SP login ID.

    So my long-winded question is has anyone else been in this situation before, see anything I am missing, or have written a custom FBA claims provider before (if that is the best solution)?

    Is there a way to either extend the MembershipUser object to include another value that the People Picker would recognize as the display name or be able to extend the People Picker?



    UPDATE: The ultimate solution is creating a custom Claims Provider. Due to time constraints and performance risks I currently implemented a work-around, in our custom Membership Provider, where the user's full name is part of the email which can be seen in the People Picker by selecting "List View" from the dropdown.

    I have provided the majority of the code used for the short-term / quick fix in a response below.

    Monday, October 3, 2011 10:53 PM

Answers

  • Actually, the display name shown in SharePoint is not my problem. I have a automated process in place that handles updating user information without manually having to run PowerShell commands. My issue is the display name in the People Picker, which dynamically shows users, not just those already in SharePoint. And even those already in SharePoint with an updated/corrected user name still don't show in the People Picker correctly because the OOB FBA Claims provider doesn't utilize the User Information List (or UserInfo table). However, I have creatd a short-term work-around for this:
     
    People Picker Short-Term Display Name Workaround:
     
    The custom Membership Provider, which runs the FBA ValidateUser and GetUser functions, I have in place obtains the FBA information from the 3rd party web service and updates the user information in the User Information List, which subsequently updates the UserInfo table in the web application content database. This not only allows me to change their name to be their First and Last name on the site, but I can update a number of other fields as well.
     
    The code fires during the login process as well as when a user is looked up in the People Picker, so as to keep information in sync as there isn't an automated timer job currently in place to syncronize data.
     
    Note: We currently aren't using MySites, so it is interesting you mention that as a trigger. I would imagine when a MySite is created it calls the Membership Provider, which would reset the user's display name to the ID. But if you use, or create, a custom Membership Provider, the below code should help.
     
    Also, while the code below currently obtains user information from a web service, you could replace the logic to pull information from anywhere, such as a SQL database.
     
    Custom Login Page 
    >> uses an asp:Login control that implements OnLoggingIn (fires before authentication)
     
    /// <summary>
    /// Validates and Creates/Updates User profile using Unique Identifier before Authentication
    /// </summary>
    protected void LoggingIn(object oSender, LoginCancelEventArgs e)
    {
        // Clears Error message
        ((Literal)signInControl.FindControl("FailureText")).Text = string.Empty;
    
        // Removes spaces around user name
        signInControl.UserName = signInControl.UserName.Trim();
    
        if (!string.IsNullOrEmpty(signInControl.UserName))
        {
            FBAMembershipProvider memProvider = new FBAMembershipProvider();
    
            // Validates User Credentials
            if (memProvider.ValidateUser(signInControl.UserName, signInControl.Password))
            {
                // Gets FBA User Info From Custom Membership Provider
                MembershipUser user = memProvider.GetUser(signInControl.UserName, true);
    
                if (user != null)
                {
                    // Replaces enter User Name with unique identifier
                    signInControl.UserName = user.UserName;
                }
                else
                {
                    ((Literal)signInControl.FindControl("FailureText")).Text = "User Information is not Valid. Please contact an administrtor.";
                    e.Cancel = true;
                }
            }
            else
            {
                ((Literal)signInControl.FindControl("FailureText")).Text = "The supplied login was invalid.";
                e.Cancel = true;
            }
        }
    }
    
     
    Custom Membership Provider
     
    /// <summary>
    /// Gets a single user with the specified user name
    /// </summary>
    /// <param name="username">The name of the user to find</param>
    /// <param name="userIsOnline">Ignored</param>
    /// <returns>The user with the specified name if found, otherwise null</returns>
    public override MembershipUser GetUser(string username, bool userIsOnline)
    {
        MembershipUser user = null;
        FBAUser fbaUser = null;
    
        try
        {
            // To increase performance, run if an email address is entered
            if (!username.Contains("@"))
            {
                if (IsNumeric(username))
                    fbaUser = new ProfileWebServicesClient().getUserByFBAID(username);
                else
                    fbaUser = new ProfileWebServicesClient().getUserByUsername(username);
    
                // Only Shows the user if they have a First Name, Last Name, and ID
                if (!string.IsNullOrEmpty(fbaUser.firstName) && !string.IsNullOrEmpty(fbaUser.lastName) && !string.IsNullOrEmpty(fbaUser.ID))
                    user = this.ToMembershipUser(fbaUser);
    
                // Obtains & Updates SP User Profile
                if (SPContext.Current != null && user != null)
                {
                    SPUser spUser = GetSPUser(user.UserName, SPContext.Current.Site.Url);
    
                    if (spUser != null)
                    {
                        UpdateSPUserInfo(spUser, fbaUser);
                    }
                }
            }
        }
        catch (Exception exception)
        {
            LogError(string.Format("An error occurred in GetUser: {0}", exception.Message));
        }
    
        return user;
    }
    
     
     
    /// <summary>
    /// Gets or Creates a User Profile on the Site
    /// </summary>
    /// <param name="username">The username to find</param>
    /// <param name="siteURL">The specified SharePoint site</param>
    /// <returns>A SharePoint User</returns>
    private SPUser GetSPUser(string username, string siteURL)
    {
        SPUser user = null;
    
        SPSecurity.RunWithElevatedPrivileges(delegate()
        {
            using (SPSite site = new SPSite(siteURL))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    // Stores current HttpContext
                    HttpContext curHttpContext = HttpContext.Current;
    
                    try
                    {
                        // Ensures updates are allowed
                        web.AllowUnsafeUpdates = true;
    
                        // Clears current HttpContext to allow retrieval or creation of FBA user
                        HttpContext.Current = null;
    
                        // Returns an existing user profile or creates one on the site
                        user = web.EnsureUser(GetFBAEncodedUserName(username));
                    }
                    finally
                    {
                        // Makes sure to turn back off unsafe updates
                        web.AllowUnsafeUpdates = false;
    
                        // Ensures current HttpContext is reset
                        HttpContext.Current = curHttpContext;
                    }
                }
            }
        });
    
        return user;
    }
    
     
    /// <summary>
    /// Converts and FBAUser to a MembershipUser
    /// </summary>
    /// <param name="user">The user to convert</param>
    /// <returns>The converted MembershipUser, or null if the FBAUser is null</returns>
    private MembershipUser ToMembershipUser(FBAUser user)
    {
        MembershipUser membershipUser = null;
    
        if (user != null)
        {
            // Due to ID shown in People Picker as ID and Display Name, the GetFullEmail shows the email in the "List view" as:
            // [First Name] [Last Name] <[Email]>
            membershipUser = new MembershipUser(this.ApplicationName, user.ID, user.ID, GetFullEmail(user), null, null, user.isApproved.Value, user.isLockedOut.Value, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.MinValue);
        }
    
        return membershipUser;
    }
     
    /// <summary>
    /// Creates an Email that contains full name and email address
    /// </summary>
    /// <param name="user">The user values to combine</param>
    /// <returns>Compiled Email</returns>
    private string GetFullEmail(AHAUser user)
    {
        /* IMPORTANT: The format of the user name >> [LastName, FirstName]
         *                     is crutial, otherwise SharePoint will through a email format
         *                     error when sending a welcome message
         */
        return string.Format("{0}, {1}{2} <{3}>",
            user.lastName.Trim(),
            user.firstName.Trim(),
            string.IsNullOrEmpty(user.middleName) ? string.Empty : " " + user.middleName.Trim(), 
            string.IsNullOrEmpty(user.email) ? "Email Not Listed" : user.email);
    }
     
    /// <summary>
    /// Returns a Claims Encode Username
    /// </summary>
    /// <param name="username">The name of the user to encode</param>
    /// <returns>Claims encoded username</returns>
    private string GetFBAEncodedUserName(string username)
    {
        // FBAProviderName is the Membership Provider listed in a Web Application Zone
        string fbaLoginName = string.Format("{0}:{1}", "FBAProviderName", username);
    
        if (!SPClaimProviderManager.IsEncodedClaim(fbaLoginName))
        {
            SPClaim claim = SPClaimProviderManager.Local.ConvertIdentifierToClaim(fbaLoginName, SPIdentifierTypes.FormsUser);
            fbaLoginName = claim.ToEncodedString();
        }
    
        return fbaLoginName.ToLower();
    }
    
     
    /// <summary>
    /// Updates an existing SharePoint User in the Site User Info List
    /// </summary>
    /// <param name="user">SPUser object</param>
    /// <param name="siteURL">Site to update user information</param>
    private void UpdateSPUserInfo(SPUser user, FBAUser userInfo)
    {
        SPSecurity.RunWithElevatedPrivileges(delegate()
        {
            if (user != null && userInfo != null)
            {
                using (SPSite site = new SPSite(user.ParentWeb.Site.ID))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        // Stores current HttpContext
                        HttpContext curHttpContext = HttpContext.Current;
    
                        try
                        {
                            // Ensures updates are allowed
                            web.AllowUnsafeUpdates = true;
    
                            // Clears current HttpContext to allow update of FBA user
                            HttpContext.Current = null;
    
                            /* Updates SP User info in the Site User Info List
                                * Note: SPUser only has name and email and as the List updates this info
                                *       there is no need to do a double update
                                */
                            bool updateUserInfoList = false;
                            SPListItem userInfoItem = web.SiteUserInfoList.GetItemById(user.ID);
    
                            // Display Name
                            if (userInfoItem.Fields.ContainsField("Title"))
                            {
                                userInfoItem["Title"] = userInfo.firstName + " " + userInfo.lastName;
                                updateUserInfoList = true;
                            }
    
                            // First Name
                            if (userInfoItem.Fields.ContainsField("FirstName"))
                            {
                                userInfoItem["FirstName"] = userInfo.firstName;
                                updateUserInfoList = true;
                            }
    
                            // Last Name
                            if (userInfoItem.Fields.ContainsField("LastName"))
                            {
                                userInfoItem["LastName"] = userInfo.lastName;
                                updateUserInfoList = true;
                            }
    
                            // Last Name
                            if (userInfoItem.Fields.ContainsField("EMail"))
                            {
                                // If email is blank or null the User Info List will retain the value shown in the People Picker
                                userInfoItem["EMail"] = (string.IsNullOrEmpty(userInfo.email) ? "Email Not Listed" : userInfo.email);
                                updateUserInfoList = true;
                            }
    
                            // Updates user info list, as needed
                            if (updateUserInfoList)
                                userInfoItem.SystemUpdate();
                        }
                        finally
                        {
                            // Makes sure to turn back off unsafe updates
                            web.AllowUnsafeUpdates = false;
    
                            // Ensures current HttpContext is reset
                            HttpContext.Current = curHttpContext;
                        }
                    }
                }
            }
        });
    }
    


    Thursday, October 6, 2011 2:03 PM

All replies

  • You can use PowerShell Set-SPUser (http://technet.microsoft.com/en-us/library/ff607827.aspx) for this.  It is a manual process, but one recommended by PSS, but Claims Auth using ADFSv2 would be another way of doing it (this may require you creating your own authentication provider for ADFSv2, as it only supports AD DS for authentication OOTB).


    http://sharepoint.nauplius.net
    Tuesday, October 4, 2011 4:35 PM
  • ADFS is actually being use for an internal domain, but what I am having difficulities with is FBA which, in this case, is validating against a 3rd party web service (not against AD). LDAP is not an option either, otherwise that would resolve this issue.

    And while the PowerShell command is a good idea, like you said it is manual. On top of that, I actually already have a custom Membership Provider which handles the calls to the 3rd party web service which is correctly updating the SPUser object and the User Information List (which also updates the UserInfo table in SQL).

    From what I have read, the issue is the oob FBA Claims Provider simply ignores the correctly set SPUser.name and just uses the MembershipUser.username as both the backend ID and the Display Name in the People Picker.

    It appears the only way to fully resolve this issue is creating you own custom Claims Provider, but I am trying to see if there is a better/different way before going this route: http://technet.microsoft.com/en-us/library/gg602068.aspx

    ============================================

    People Picker and claims providers

    A claims provider lists, resolves, searches, and determines the "friendly" display of users, groups, and claims in the People Picker when claims-based authentication is used. If your Web application uses claims-based authentication, you must decide whether to use one of the default claims providers or create a custom claims provider that will meet the business needs of your organization.

    Wednesday, October 5, 2011 2:03 AM
  • However, that all being said, I was able to create a work-around that so far seems to be successful. Since the MembershipUser object does have an email, I simply have it show: "first name last name <email>" which can be seen in the People Picker by selecting "List View" in the dropdown. In the custom Membership Provider, the email stored in SharePoint is updated to be just the email address.

    The only thing I haven't tested yet is how SharePoint handles the email format if a user leaves the box check to send user an email when they are added to a SP Security group.

    This is not an ideal fix, but for the short-term is is better than just seeing a numerical ID in the results.

    Wednesday, October 5, 2011 2:04 AM
  • You have to create a Custom Claims Provider.  I've had a case open with Microsoft for about 2 months now regarding this (the user's log in with a mail attribute, but as soon as they create a Profile by going to My Sites, it changes the display name to the FBA name as you describe).  It is still open, so if we find anything OOTB that can be done, I'll reply, but for now the only 'resolution' I've gotten is to use PowerShell to change the user's display name.
    http://sharepoint.nauplius.net
    Wednesday, October 5, 2011 2:11 AM
  • Actually, the display name shown in SharePoint is not my problem. I have a automated process in place that handles updating user information without manually having to run PowerShell commands. My issue is the display name in the People Picker, which dynamically shows users, not just those already in SharePoint. And even those already in SharePoint with an updated/corrected user name still don't show in the People Picker correctly because the OOB FBA Claims provider doesn't utilize the User Information List (or UserInfo table). However, I have creatd a short-term work-around for this:
     
    People Picker Short-Term Display Name Workaround:
     
    The custom Membership Provider, which runs the FBA ValidateUser and GetUser functions, I have in place obtains the FBA information from the 3rd party web service and updates the user information in the User Information List, which subsequently updates the UserInfo table in the web application content database. This not only allows me to change their name to be their First and Last name on the site, but I can update a number of other fields as well.
     
    The code fires during the login process as well as when a user is looked up in the People Picker, so as to keep information in sync as there isn't an automated timer job currently in place to syncronize data.
     
    Note: We currently aren't using MySites, so it is interesting you mention that as a trigger. I would imagine when a MySite is created it calls the Membership Provider, which would reset the user's display name to the ID. But if you use, or create, a custom Membership Provider, the below code should help.
     
    Also, while the code below currently obtains user information from a web service, you could replace the logic to pull information from anywhere, such as a SQL database.
     
    Custom Login Page 
    >> uses an asp:Login control that implements OnLoggingIn (fires before authentication)
     
    /// <summary>
    /// Validates and Creates/Updates User profile using Unique Identifier before Authentication
    /// </summary>
    protected void LoggingIn(object oSender, LoginCancelEventArgs e)
    {
        // Clears Error message
        ((Literal)signInControl.FindControl("FailureText")).Text = string.Empty;
    
        // Removes spaces around user name
        signInControl.UserName = signInControl.UserName.Trim();
    
        if (!string.IsNullOrEmpty(signInControl.UserName))
        {
            FBAMembershipProvider memProvider = new FBAMembershipProvider();
    
            // Validates User Credentials
            if (memProvider.ValidateUser(signInControl.UserName, signInControl.Password))
            {
                // Gets FBA User Info From Custom Membership Provider
                MembershipUser user = memProvider.GetUser(signInControl.UserName, true);
    
                if (user != null)
                {
                    // Replaces enter User Name with unique identifier
                    signInControl.UserName = user.UserName;
                }
                else
                {
                    ((Literal)signInControl.FindControl("FailureText")).Text = "User Information is not Valid. Please contact an administrtor.";
                    e.Cancel = true;
                }
            }
            else
            {
                ((Literal)signInControl.FindControl("FailureText")).Text = "The supplied login was invalid.";
                e.Cancel = true;
            }
        }
    }
    
     
    Custom Membership Provider
     
    /// <summary>
    /// Gets a single user with the specified user name
    /// </summary>
    /// <param name="username">The name of the user to find</param>
    /// <param name="userIsOnline">Ignored</param>
    /// <returns>The user with the specified name if found, otherwise null</returns>
    public override MembershipUser GetUser(string username, bool userIsOnline)
    {
        MembershipUser user = null;
        FBAUser fbaUser = null;
    
        try
        {
            // To increase performance, run if an email address is entered
            if (!username.Contains("@"))
            {
                if (IsNumeric(username))
                    fbaUser = new ProfileWebServicesClient().getUserByFBAID(username);
                else
                    fbaUser = new ProfileWebServicesClient().getUserByUsername(username);
    
                // Only Shows the user if they have a First Name, Last Name, and ID
                if (!string.IsNullOrEmpty(fbaUser.firstName) && !string.IsNullOrEmpty(fbaUser.lastName) && !string.IsNullOrEmpty(fbaUser.ID))
                    user = this.ToMembershipUser(fbaUser);
    
                // Obtains & Updates SP User Profile
                if (SPContext.Current != null && user != null)
                {
                    SPUser spUser = GetSPUser(user.UserName, SPContext.Current.Site.Url);
    
                    if (spUser != null)
                    {
                        UpdateSPUserInfo(spUser, fbaUser);
                    }
                }
            }
        }
        catch (Exception exception)
        {
            LogError(string.Format("An error occurred in GetUser: {0}", exception.Message));
        }
    
        return user;
    }
    
     
     
    /// <summary>
    /// Gets or Creates a User Profile on the Site
    /// </summary>
    /// <param name="username">The username to find</param>
    /// <param name="siteURL">The specified SharePoint site</param>
    /// <returns>A SharePoint User</returns>
    private SPUser GetSPUser(string username, string siteURL)
    {
        SPUser user = null;
    
        SPSecurity.RunWithElevatedPrivileges(delegate()
        {
            using (SPSite site = new SPSite(siteURL))
            {
                using (SPWeb web = site.OpenWeb())
                {
                    // Stores current HttpContext
                    HttpContext curHttpContext = HttpContext.Current;
    
                    try
                    {
                        // Ensures updates are allowed
                        web.AllowUnsafeUpdates = true;
    
                        // Clears current HttpContext to allow retrieval or creation of FBA user
                        HttpContext.Current = null;
    
                        // Returns an existing user profile or creates one on the site
                        user = web.EnsureUser(GetFBAEncodedUserName(username));
                    }
                    finally
                    {
                        // Makes sure to turn back off unsafe updates
                        web.AllowUnsafeUpdates = false;
    
                        // Ensures current HttpContext is reset
                        HttpContext.Current = curHttpContext;
                    }
                }
            }
        });
    
        return user;
    }
    
     
    /// <summary>
    /// Converts and FBAUser to a MembershipUser
    /// </summary>
    /// <param name="user">The user to convert</param>
    /// <returns>The converted MembershipUser, or null if the FBAUser is null</returns>
    private MembershipUser ToMembershipUser(FBAUser user)
    {
        MembershipUser membershipUser = null;
    
        if (user != null)
        {
            // Due to ID shown in People Picker as ID and Display Name, the GetFullEmail shows the email in the "List view" as:
            // [First Name] [Last Name] <[Email]>
            membershipUser = new MembershipUser(this.ApplicationName, user.ID, user.ID, GetFullEmail(user), null, null, user.isApproved.Value, user.isLockedOut.Value, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.Now, DateTime.MinValue);
        }
    
        return membershipUser;
    }
     
    /// <summary>
    /// Creates an Email that contains full name and email address
    /// </summary>
    /// <param name="user">The user values to combine</param>
    /// <returns>Compiled Email</returns>
    private string GetFullEmail(AHAUser user)
    {
        /* IMPORTANT: The format of the user name >> [LastName, FirstName]
         *                     is crutial, otherwise SharePoint will through a email format
         *                     error when sending a welcome message
         */
        return string.Format("{0}, {1}{2} <{3}>",
            user.lastName.Trim(),
            user.firstName.Trim(),
            string.IsNullOrEmpty(user.middleName) ? string.Empty : " " + user.middleName.Trim(), 
            string.IsNullOrEmpty(user.email) ? "Email Not Listed" : user.email);
    }
     
    /// <summary>
    /// Returns a Claims Encode Username
    /// </summary>
    /// <param name="username">The name of the user to encode</param>
    /// <returns>Claims encoded username</returns>
    private string GetFBAEncodedUserName(string username)
    {
        // FBAProviderName is the Membership Provider listed in a Web Application Zone
        string fbaLoginName = string.Format("{0}:{1}", "FBAProviderName", username);
    
        if (!SPClaimProviderManager.IsEncodedClaim(fbaLoginName))
        {
            SPClaim claim = SPClaimProviderManager.Local.ConvertIdentifierToClaim(fbaLoginName, SPIdentifierTypes.FormsUser);
            fbaLoginName = claim.ToEncodedString();
        }
    
        return fbaLoginName.ToLower();
    }
    
     
    /// <summary>
    /// Updates an existing SharePoint User in the Site User Info List
    /// </summary>
    /// <param name="user">SPUser object</param>
    /// <param name="siteURL">Site to update user information</param>
    private void UpdateSPUserInfo(SPUser user, FBAUser userInfo)
    {
        SPSecurity.RunWithElevatedPrivileges(delegate()
        {
            if (user != null && userInfo != null)
            {
                using (SPSite site = new SPSite(user.ParentWeb.Site.ID))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        // Stores current HttpContext
                        HttpContext curHttpContext = HttpContext.Current;
    
                        try
                        {
                            // Ensures updates are allowed
                            web.AllowUnsafeUpdates = true;
    
                            // Clears current HttpContext to allow update of FBA user
                            HttpContext.Current = null;
    
                            /* Updates SP User info in the Site User Info List
                                * Note: SPUser only has name and email and as the List updates this info
                                *       there is no need to do a double update
                                */
                            bool updateUserInfoList = false;
                            SPListItem userInfoItem = web.SiteUserInfoList.GetItemById(user.ID);
    
                            // Display Name
                            if (userInfoItem.Fields.ContainsField("Title"))
                            {
                                userInfoItem["Title"] = userInfo.firstName + " " + userInfo.lastName;
                                updateUserInfoList = true;
                            }
    
                            // First Name
                            if (userInfoItem.Fields.ContainsField("FirstName"))
                            {
                                userInfoItem["FirstName"] = userInfo.firstName;
                                updateUserInfoList = true;
                            }
    
                            // Last Name
                            if (userInfoItem.Fields.ContainsField("LastName"))
                            {
                                userInfoItem["LastName"] = userInfo.lastName;
                                updateUserInfoList = true;
                            }
    
                            // Last Name
                            if (userInfoItem.Fields.ContainsField("EMail"))
                            {
                                // If email is blank or null the User Info List will retain the value shown in the People Picker
                                userInfoItem["EMail"] = (string.IsNullOrEmpty(userInfo.email) ? "Email Not Listed" : userInfo.email);
                                updateUserInfoList = true;
                            }
    
                            // Updates user info list, as needed
                            if (updateUserInfoList)
                                userInfoItem.SystemUpdate();
                        }
                        finally
                        {
                            // Makes sure to turn back off unsafe updates
                            web.AllowUnsafeUpdates = false;
    
                            // Ensures current HttpContext is reset
                            HttpContext.Current = curHttpContext;
                        }
                    }
                }
            }
        });
    }
    


    Thursday, October 6, 2011 2:03 PM
  • Hey Justin,

    It would be very helpful if you could also provide the definition of your "Consts" collection to the community.

    Thanks
    C

     


    I trust that answers your question...

    Thanks
    C

    http://www.cjvandyk.com/blog | LinkedIn | Facebook | Twitter | Codeplex
    Friday, October 14, 2011 12:37 PM
    Answerer
  • Ah, good call Cornelius.

    I updated my solution to have it contain my constants and also added the GetFullEmail method I use to combine the user's name and email address.

    Monday, October 17, 2011 3:01 PM
  • Awesome!  Thanks Justin.
    I trust that answers your question...

    Thanks
    C

    http://www.cjvandyk.com/blog | LinkedIn | Facebook | Twitter | Codeplex
    Tuesday, October 18, 2011 3:05 PM
    Answerer
  • Hi Justin,

    I have used FBA - Active Directory authentication. and I also face the same problem as yours - for display name in people picker. 

    I have actually made the columns "Name", "First Name", "Last Name" etc. editable in "User Information List" using powershell commands. so whenever we add a new user, we can also update these columns and so the name from the column "Name" appears as login name (in top right menu) which is fine and exactly the way I wanted. However, it still shows the UserID in people picker field. I want that it shows "Name" value in people picker text box after validating the user once we click on "Check Names" button. Can you tell me if the solution you suggested above can help me in achieving the same ? In other words I can also say that I want to change "Display Name" value (list view in people picker search screen) of the user. I want to replace it with the "Name" column of User Info List. presently it shows UserID as the display name in people picker. 

    I think the workaround that you have implemented is you have changed the e-mail property of a user. so when user enters user in people picker, they can see the e-mail choosing list view and confirm that yes this is the user that they wanted to refer. But does your code actually displays the name of a user as display name? or it still shows the ID as display name ?  Can I change membership user.UserName properlty and set it to the spuser.name property, if not by code then powershell command..but is it possible to change membershipuser. username property value ?


    Swati Soneji


    Monday, February 13, 2012 9:38 AM
  • Could I ask how you were able to make the User Profile fields editable?
    Friday, July 19, 2013 6:14 PM