SiteData.GetListItems Method
Performs a query against the specified SharePoint list.
Namespace: [SiteData Web service]
Web service reference: http://Site/_vti_bin/SiteData.asmx
Syntax
'Declaration
<SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/GetListItems", RequestNamespace := "https://schemas.microsoft.com/sharepoint/soap/", _
ResponseNamespace := "https://schemas.microsoft.com/sharepoint/soap/", _
Use := SoapBindingUse.Literal, ParameterStyle := SoapParameterStyle.Wrapped)> _
Public Function GetListItems ( _
strListName As String, _
strQuery As String, _
strViewFields As String, _
uRowLimit As UInteger _
) As String
'Usage
Dim instance As SiteData
Dim strListName As String
Dim strQuery As String
Dim strViewFields As String
Dim uRowLimit As UInteger
Dim returnValue As String
returnValue = instance.GetListItems(strListName, _
strQuery, strViewFields, uRowLimit)
[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/GetListItems", RequestNamespace = "https://schemas.microsoft.com/sharepoint/soap/",
ResponseNamespace = "https://schemas.microsoft.com/sharepoint/soap/",
Use = SoapBindingUse.Literal, ParameterStyle = SoapParameterStyle.Wrapped)]
public string GetListItems(
string strListName,
string strQuery,
string strViewFields,
uint uRowLimit
)
Parameters
strListName
Type: System.StringA string that contains the GUID of the list enclosed in curly braces ({}).
strQuery
Type: System.StringA string in the following form containing the Where clause of a Query element that specifies a filter for the query:
<Where> <Lt> <FieldRef Name="ID" /> <Value Type="Counter">3</Value> </Lt> </Where>
strViewFields
Type: System.StringA string in the following form containing the field references of a ViewFields element that specify which fields to return in the query:
<FieldRef Name="ID" /> <FieldRef Name="Title" />
uRowLimit
Type: System.UInt32A 32-bit unsigned integer that specifies the number of rows to return in the query.
Return Value
Type: System.String
A string in XML data format that contains a schema and the data returned through the query, as follows:
<xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
<s:Schema id="RowsetSchema">
<s:ElementType name="row" content="eltOnly" rs:CommandTimeout="30">
<s:AttributeType name="ows_Title" rs:name="Title" rs:number="1">
<s:datatype dt:type="string" dt:maxLength="512" />
</s:AttributeType>
<s:AttributeType name="ows_Number" rs:name="Number" rs:number="2">
<s:datatype dt:type="float" dt:maxLength="8" />
</s:AttributeType>
<s:AttributeType name="ows_ID" rs:name="ID" rs:number="3">
<s:datatype dt:type="i4" dt:maxLength="4" />
</s:AttributeType>
<s:AttributeType name="ows_owshiddenversion" rs:name="owshiddenversion" rs:number="4">
<s:datatype dt:type="i4" dt:maxLength="4" />
</s:AttributeType>
</s:ElementType>
</s:Schema>
<rs:data ItemCount="1">
<z:row ows_Title="Value1" ows_Number="100.000000000000" ows_ID="1" ows_owshiddenversion="2" />
<z:row ows_Title="Value2" ows_Number="100.000000000000" ows_ID="2" ows_owshiddenversion="2" />
.
.
.
</rs:data>
</xml>
Examples
The following code example returns items from a list where the value for a specified number field equals 1450. This example assumes the existence of a label within the form of a Windows Application.
Dim srvSiteData As New Web_Reference_Name.SiteData()
srvSiteData.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim items As String = srvSiteData.GetListItems("{e5c6603b-0f6c-4bd9-8bb1-57c83854308b}", _
"<Where><Eq><FieldRef Name="Field"/><Value Type="Number">1450</Value></Eq></Where>", _
"<FieldRef Name="Title"/><FieldRef Name="Number"/>", 100)
label1.Text = items
Web_Reference_Name.SiteData srvSiteData = new Web_Reference_Name.SiteData();
srvSiteData.Credentials = System.Net.CredentialCache.DefaultCredentials;
string items = srvSiteData.GetListItems("{e5c6603b-0f6c-4bd9-8bb1-57c83854308b}",
"<Where><Eq><FieldRef Name=\"Field\"/><Value Type=\"Number\">1450</Value></Eq></Where>",
"<FieldRef Name=\"Title\"/><FieldRef Name=\"Number\"/>", 100);
label1.Text = items;