Udated Code: See http://www.wssdemo.com/Blog/archive/2008/12/23/Update-to-SharePoint-My-Site-redirect.aspx
SharePoint provides rich integration between content and users (Office Communicator presence information and a hyperlink to display user details). This can be seen everywhere a user name is assigned to a piece of content which can be:
- Created/Modified By details for any item display page or view that includes these columns
- Site group membership from settings page or web part
- People & Group column added to any list/library
- Workflow and version details
For Microsoft Office SharePoint Server 2007, some customers find that clicking on a user name takes them to the My Site persondetails.aspx page while others only see the simple WSS userdisp.aspx page. Why is that?
All people links go to http://SiteCollectionURL/SiteURL/_layouts/userdisp.aspx?ID=17&Source=... And this page decides whether to redirect to the My Site provider defined in the SSP that the Web Application containing the content site collection is assigned to based on one of the following rules:
- Host name of the My Site web application matches the site from where userdisp.aspx is called (i.e. both web applications are running on different port numbers)
- The site collection where userdisp.aspx is called from has a Portal Connection setting which is set to the My Site url (this would add the My Site to the start of the breadcrumb navigation for OOTB master pages which most customers don't want)
Figure 1: WSS simple user details page (happy Adam?)
I found many references to this problem searching on the web and several proposed solutions that were flawed so, here is a solution that works and has been tested in a medium farm environment of 3 WFE's and 14,000 users in the profile db(thanks to my colleague Craig for refining my solution down to the 4 lines of code).
The solution would be for Microsoft to fix this. It is obvious based on the Intranet Web Application -> SSP -> MySite relationship that they are trusted.
My solution involves modifying the userdisp.aspx page in the 12\templates\layouts directory so you should review this article first http://support.microsoft.com/kb/944105
This solution doesn’t even require users to have a physical My Site or even permissions to create a My Site. All you have to do is verify that the public page has the correct permissions by browsing to the permissions page on the My Site Host.
Add the following line to the start of the first line in userdisp.aspx
<%@ Assembly Name="Microsoft.Office.Server, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
Add the rest of this code just before the final </asp:Content> tag at the bottom of the page
<%
// Changes to redirect User Display to My Site if the user has a profile in the SSP
try
{
UserProfileManager profileManager = new UserProfileManager(ServerContext.Default);
bool userExists = profileManager.UserExists(this.UserListForm.Item["Account"].ToString());
if (userExists)
{
Response.Redirect(profileManager.MySiteHostUrl + "/Person.aspx?accountname=" + this.UserListForm.Item["Account"].ToString());
}
}
catch
{
// do nothing, original userdisp content will be displayed
}
%>
There is a scenario not covered by this customization or the OOTB userdisp page and that is when the user has been deleted from AD, removed from the SPS User Profile and deleted from the Site Collection. The OOTB userdisp.aspx page just shows an error but in some customer environments there may be historical information about people who have left for auditing purposes (like their job title, cost center, termination date or manager were) which would be useful to display.