Posted by Adam Buenz
Man, I have never seen this before, but doing a simple SPListItem.URL and returning the URL returns a funky ass value. It looks like hex or some crap, like this:
http://localhost/lists/MyList/6_.000
What the hell is that? Shouldn't the SPListItem.Url property return the actual URL to the item?
To get around this, you have to tailor your code a little bit differently.
C#:
-
SPList list = site.Lists.GetList("MyList");
-
-
SPListItem item = list.Items[id];
-
-
list.Forms[PAGETYPE.PAGE_DISPLAYFORM].Url + "?ID=" + item.ID
Now you will actual retrieve the correct path to the DispForm.aspx page.
Wierd, eh?











August 28th, 2007 at 6:39 am
Man that is so weird!
August 28th, 2007 at 9:01 am
In fact this property works only for Doc items ...
August 28th, 2007 at 10:34 am
That, I didn't know. Thanks for the tip Renaud!
August 28th, 2007 at 2:06 pm
[...] Man, I have never seen this before, but doing a simple SPListItem.URL and returning the URL returns a funky ass value. It looks like hex or some crap, like this: http://localhost/lists/MyList/6_.000 What the hell is that? Shouldn't the SPListItem Read More……(read more) [...]
August 28th, 2007 at 5:24 pm
[...] SPListItem.URL Funky Return Fiesta [...]
August 30th, 2007 at 5:04 am
Interestingly enough, the List.Forms[PAGETYPE.PAGE_DISPLAYFORM].Url code returns someting fishy for me too:
I get http://tabeokaser001/test_menno/Pages/Lists/TEST/DispForm.aspx, while the correct url is http://tabeokaser001/test_menno/Lists/TEST/DispForm.aspx?ID=1 (without 'Pages').
I think I'll fiddle with PAGETYPE.PAGE_DISPLAYFORM some more, and see what I can come up with.
August 30th, 2007 at 6:01 am
Well part of that makes sense, you should get that unless you are appending the + "?ID=" + item.ID so that it is aware of which SPListItem ID to point to. The other part, where it is truncated "Pages" out of the name, I don't know where it comes from.
I have also noticed that sometimes it does not work on custom list types, which is weird, because it should. If you can post back your results it would be appreciated!
March 11th, 2008 at 8:44 am
Hi, thx it helped me out.
Worked with my custom list but I had to change it a bit to not get the /Pages/ before.
myList.Forms[PAGETYPE.PAGE_DISPLAYFORM].ServerRelativeUrl + "?ID=" + myItem.ID