Getting all Items, not just default view

Jul 10, 2009 at 1:07 AM

Wow, this thing is totally AWESOME!  I have one question though.

I'm using the sharepointutility.dll to pull information from a list.  I have been doing this through straight web services (which is a pain).  When a query a list through the WS I get all items back regardless of view settings.  When I use the DLL I get just the items in the default view for the list.  How do I change it so I ignore views?

Here's my code:

 

Dim fieldNames As New List(Of String)
        Dim linqXML As Linq.XElement = New XElement("ID")
        Dim result As New List(Of Dictionary(Of String, String))
        Dim columnResult As New List(Of ColumnData)
        fieldNames.Add("ID")
        fieldNames.Add("Title")
        result = ListServiceUtility.GetListItemData("http://myigt.com/projectcentral/home/BPSC", "Project Charters", fieldNames, linqXML, True, 1000)
        Dim fieldNames As New List(Of String)
        Dim linqXML As Linq.XElement = New XElement("ID")  'not sure what to put in here if I'm not using CAML so I just put in some text
        Dim result As New List(Of Dictionary(Of String, String))
        Dim columnResult As New List(Of ColumnData)

        fieldNames.Add("ID")
        fieldNames.Add("Title")

        result = ListServiceUtility.GetListItemData("http://myURL", "Project Charters", fieldNames, linqXML, False, 1000)
Thanks!
-Nate
p.s. What does the recursive flag do?

 

Jul 10, 2009 at 6:02 PM

Looks like I was using 1.0 of the DLL and not 2.0.  I thought I got it off the main page but I may be mistaken.

I downloaded the source code and looked through it and saw that you can specify a view to pull.  I made that "All Items" and I got my entire list back.  Here' s the code incase anyone else runs into the same problem.

 

 

        Dim fieldNames As New List(Of String)
        Dim linqXML As Linq.XElement = New XElement("ID")
        Dim result As New List(Of Dictionary(Of String, String))
        Dim columnResult As New List(Of ColumnData)

        Dim myURI As New Uri("http://mySite.com")
        fieldNames.Add("ID")
        fieldNames.Add("Title")

        result = ListServiceUtility.GetListItemData(myURI, "Project Charters", "All Items", fieldNames, linqXML, True, 1000)

P.S. Recursive just gets folders inside of lists.

 

Sep 29, 2009 at 6:19 AM

I'm very happy you got this to work, and even MORE happy you found the DLL useful.  I think the DLLS are one of those most underused things in the whole adapter :)