Retrieving Sharepoint List using List() web service

Qrat

New member
Joined
Jun 12, 2012
Messages
1
Programming Experience
3-5
So I've been trying to retrieve a list from sharepoint using Lists() web services and then displaying the list on a datagrid. However I am having some weird problem. My code so far is




'Declare and initialize Lists Web service.
Dim listService As New Lists()

'Authenticate
listService.Credentials = System.Net.CredentialCache.DefaultCredentials

'Set the Url property of the service for the path to a subsite.
listService.Url = "http://server/sites/thelist/_vti_bin/lists.asmx"

Dim testlistid As String = "the list GUID"
Dim testlistview As String = "the list view GUID"

Dim caml As New XmlDocument
Dim querynode As XmlNode = caml.CreateElement("Query")

querynode.InnerXml = ""

Dim viewNode As XmlNode = caml.CreateElement("ViewFields")

Dim optionnode As XmlNode = caml.CreateElement("QueryOptions")

optionnode.InnerXml = "FALSE"


Dim ndListView As System.Xml.XmlNode = listService.GetListItems(listid, viewlist, querynode, _
Nothing, "150", optionnode)


Dim ds As New DataSet()
Dim sr As XmlNodeReader = New XmlNodeReader(ndListView)


ds.ReadXml(sr)


ListViewtbl.DataSource = ds.Tables(1).DefaultView


This retrieves the list and displays it on the datagrid.

However,
1) It also displays a column called "ows_owsHiddenversion" which I have no idea where it's coming from.
2) The order of the columns that are displayed are different from the order in the sharepoint site.
3) I have a column called "DONE?" and it is a choice type with the options of choosing 'Yes' or 'No'. But for some reason, in the datagrid, the column under DONE is all blank and I cant figure out why all the 'Yes's and 'No's are not showing up. All the other values for the other columns appear fine.
4) I am sorting the data from the sharepoint list by the "Division" column which is fine but the header of the column in the datagrid is labeled "Title". I checked the XmlNode outer and inner xml and for some reason the Field Ref is set to "Title" to represent the "Division" column

Any help would be greatly appreciated.
 
Back
Top