views:

200

answers:

2

I'm using web.Site.MakeFullUrl((new SPFieldLookupValue(row["FileRef"] as string).LookupValue)) to get the URL to results in a GetSiteData query.

For some items this works fine, but for others I get results like http://server/Lists/My%20Message%20Board/Test/9_.000 - which always 404s. The urls always end in n_.0000.

Does anybody know why this is happening and how to get the correct URL?

+1  A: 

I'm not sure why the URL property returns such a weird value. But look at this blog post for some ways to construct a correct URL: http://blogs.tamtam.nl/duarte/2009/02/12/SPListItemURLReturnsInvalidURL.aspx

strongopinions
A: 

The items generating the weird url are not items in a Document Library that have a file associated with the actual SPListItem. The "normal" urls are urls to files in a doc lib, the weird ones are urls to items in a regular list. Just check for the type of item in the webpart / control / xsl to render the results.

If it is an item from a regular list (with the weird url), just replace it and make the url look like so:

http://server/Lists/My%20Message%20Board/Test/9%5F.000 should be:

http://server/Lists/My%20Message%20Board/Test/AllItems.aspx?ID=ITEMID

Colin