About      |       Articles      |      Services      |      Software      |      Contact

Latest Free SharePoint Software

ARB Security Solutions regularly releases free SharePoint software, including WebParts, Client Applications, Framework Extensions, and other Miscellaneous Components.
The most recent freeware is:

Title: Simple SharePoint Rollup WebPart
Date Published: 10/22/2009

Previous Two Free WebPart Releases:

SecureCenter For SharePoint

By SharePoint security integrators, for SharePoint security integrators.

SharePoint Security Assurance Program™

For externally facing SharePoint deployments, security is an acutely important deployment concern. Learn how through daily security scanning, you can ensure external business users and partners that they can collaborate in confidence!

Security Assurance WebPart:



SPListItem.URL Funky Return Fiesta

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#:
  1. SPList list = site.Lists.GetList("MyList");
  2.  
  3. SPListItem item = list.Items[id];
  4.  
  5. list.Forms[PAGETYPE.PAGE_DISPLAYFORM].Url + "?ID=" + item.ID

Now you will actual retrieve the correct path to the DispForm.aspx page.

Wierd, eh? :)

  • Share/Bookmark

13 Comments »

  1. Man that is so weird!

    Comment by Stacy Draper — August 28, 2007 @ 6:39 am

  2. In fact this property works only for Doc items …

    Comment by Renaud Comte — August 28, 2007 @ 9:01 am

  3. That, I didn’t know. Thanks for the tip Renaud!

    Comment by Adam Buenz — August 28, 2007 @ 10:34 am

  4. [...] 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) [...]

    Pingback by Blogger Loser » Blog Archive » SPListItem.URL Funky Return Fiesta — August 28, 2007 @ 2:06 pm

  5. [...] SPListItem.URL Funky Return Fiesta [...]

    Pingback by Links (8/28/2007) « Steve Pietrek’s SharePoint Stuff — August 28, 2007 @ 5:24 pm

  6. 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.

    Comment by Menno — August 30, 2007 @ 5:04 am

  7. 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!

    Comment by Adam Buenz — August 30, 2007 @ 6:01 am

  8. 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

    Comment by Djavan ROA — March 11, 2008 @ 8:44 am

  9. coolio, just what i was looking for.

    Comment by Hal Diggs — October 8, 2008 @ 3:33 pm

  10. Seems to work for me. Might some people be getting problems with the Url if they’re using a customer display form? In which case the form might be stored inside the pages list.

    I’m just guessing here. I’ve not used customer display forms yet.

    Comment by Daniel Revell — March 18, 2009 @ 7:02 am

  11. [...] http://www.sharepointsecurity.com/sharepoint/sharepoint-development/splistitemurl-funky-return-fiest... [...]

    Pingback by SPListItem Url | blog.richardramdat.com — September 29, 2009 @ 9:38 pm

  12. Hi,

    Not sure if this helps anyone at this point, but depending on whether or not the default dispform has been changed for the list item’s content type, this might help resolve the proper display form.

    Once you have the list item, you can get the content type of the item and check the DisplayFormUrl before using the PAGE_DISPLAYFORM. For example,

    SPListItem listItem = list.GetItemById( itemId );

    SPContentType contentType = listItem.ContentType;

    string urlToItem = type.DisplayFormUrl;

    if(String.IsNullOrEmpty(urlToItem))

    Comment by Robert Beard — December 7, 2009 @ 10:56 pm

  13. Great tip Robert!

    Comment by adam — December 8, 2009 @ 6:46 am

RSS feed for comments on this post. TrackBack URL

Leave a comment