FileRef vs EncodedAbsUrl

During the last days I found myself applying a lot of small post-migration patches, some of which can be accomplished with some (PowerShell) script, some of which I keep doing everything by hand.

The last one, and the one I’m talking about here, is related to a couple of custom DataFormWebParts that used the FileRef attribute of the SPListDataSource to render hyperlinks.

Now, it seems that in SharePoint 2007 these attributes return a site relative url with a leading slash (i.e.: /sites/somethingelse/etc), whereas I inspected the same attributes in a SharePoint 2010 environment and I got the site relative path without the leading slash. This, of course, causes the links to be considered relative to the current path, and the final effect is a lot of 404 all around.

The fix is super easy: I substituted the FileRef attribute with the EncodedAbsUrl attribute, which return exactly what I was expecting.

Sgunf 🙁