Monday, September 17, 2007

FBA and friendly display name in SharePoint 2007

If you have ever implemented the form authentication(FBA) in SharePoint, you will soon experience that SharePoint treats non AD authentication as a step child. Though , its very simple and straight forward to implement a form based authentication however it is not the same user experience as you would expect or see with Active Directory based authentication.

One thing immediately becames visible is the user name. When you log with Active Directory you see a friendly name like shown below.





However , with the form authentication you see the loginId and NOT the FirstName & Last Name, you would like to see.The reason is simple. The standard MembershipUser interface, only has one property called "UserName", This properly holds the fully qualified user name ( domain/username) or (membershipprovider/userId) .
So how do we display a friendly name? After investigating, I came up with two options.
1) User Profile (MOSS Only)
It appears that SharePoint read the friendly display name from the user profile of a user if one exists. By default there is no user profile created for FBA. You can manually create a user profile for all users via SSP or programmatically create for all users.
I found following utility by Sahil , which takes a xml file and does bulk user profile import. Sahils' also shows a code snippet on how to programmatically create user profile

http://blah.winsmarts.com/2007-1-SharePoint_2007_Utility_-2_-_PI_-_Utility_to_Import-Export_actual_user_profiles.aspx
2) UserInfo table (WSS and MOSS)
This solution requires direct update to SharePoint table but does work. So I recommend carefully planning before any update.

At every site collection level, SharePoint stores the firstname + last name in the userInfo table . The friendly name is appears to be picked up from the tp_title column. I believe SharePoint creates entry in this table, the first time you add a user in any list or a site ACL. Look for your form authenticatation (FBA) userId in this table and replace it with a friendly name.

I think this is a good enhancement request for MembershipProvider and SharePoint team

6 comments:

Krishna Prasad said...

Super !! It helped me a lot.

jmanley said...

I'm trying to implement Search Server Express with Forms Based Authentication, however when searching file shares and using FBA i do not get any results, when using Windows and searching i get results checking the indexing status shows that it did index files, i am assuming that since MSSX limits results based on the files ACL on disk that that information is not carried over when i use FBA? Any suggestions??

vfdvgf said...
This comment has been removed by a blog administrator.
vfdvgf said...
This comment has been removed by a blog administrator.
Todd said...

I think most people would recommend against modifying the SharePoint DB directly, and I personally didn't like having to run a batch job to keep things in sync.

Stumbled on this other post, which has a great idea, which led me to the final solution (using the SP web services' UserGroup.UpdateUserInfo method).

http://stackoverflow.com/questions/1898756/fba-display-name-with-custom-membership-provider-wss-3-0/

dan rogy said...

My current project requires ability to display choice column value via color or image associated with a choice

But Sharepoint standard packaged misses that control

I am looking for available solutions on market

I came across

http://amazepoint.com/Products/VisualChoiceColumn/Overview.aspx>

Does anybody has experiece using it?