Potential gotcha with custom display forms
Hi,
On a recent project, I've been involved in analyzing the WSS_Logging database for reporting purposes. As you certainly know already, this database contains a lof of information regarding usage & health of the SharePoint farms.
This database is opened for read/write and Microsoft even provides APIs for that purpose. For more info, I encourage you to read Todd Carter's excellent blog post here:
http://todd-carter.com/post/2011/05/03/Extending-The-SharePoint-2010-Hea...
I've been digging more particularly in the view called [WSS_Logging].[dbo].[RequestUsage] since it contains a lot of valuable information for reporting. In a few words, we could say that this is a staging view containing IIS Logs equivalent information plus some SharePoint specific columns. One of them has a great business value and is the Title column that holds the value of SharePoint list items.
To me, that's very interesting because it's meaningfull for the business. If they give relevant titles to their pages, list items etc...they'll easily identify those items in the reports.
However, I faced one problem with some legacy code where the default displayform of a given list had been completely modified and almost none of the SharePoint controls was declared. This resulted in wrong results in WSS_Logging since visits on this list items caused the system to save the list title instead of the item title for every item that was visited.
After comparing an out of the box display form with the custom one, I found out that just declaring the following control in the content placeholder PlaceHolderPageTitleInTitleArea of the custom DispForm.aspx was enough to get the right value back in the database:
<SharePoint:ListProperty Property="LinkTitle" runat="server"/>: <SharePoint:ListItemProperty runat="server"/>
Happy Coding!