Hi,
does anybody know, how i could get all items from a SharePoint-List?
It should be possible to call the function getListItems() with 4 parameters. One for the list where the information is stored in. one for the query. the third for the displayed fields. and the fourth that specifies the number of rows to return.
My code is:
<cfobject webservice="http://sharepointserver:16999/blog/_vti_bin/SiteData.asmx?wsdl" name="siteDataService"
password="pw"
username="user"
>
<cfset siteDataService.GetListItems(
"{9BE74555-1150-4AC8-ADE7-EE52923D7CE8}",
"<Where><Lt><FieldRef Name=""ID"" /><Value Type=""Counter"">3</Value></Lt></Where>",
"<FieldRef Name=""ID"" /><FieldRef Name=""Title"" />",
"4"
)>
<cfset ServiceResponse = GetSOAPResponse(siteDataService)>
<cfdump var="#ServiceResponse#">
But all i get is that errormessage:
Web service operation GetListItems with parameters {{9BE74555-1150-4AC8-ADE7-EE52923D7CE8},3,,4} cannot be found.
Normaly you have to pass xmlNodes the the function, like it is told here.
I also tried that, but don't know exactly how to make a xmlNode. My code, that also doesn't work is this one:
<cfset xmlDoc = XmlNew()>
<cfset ndQuery = xmlElemNew(xmlDoc, "Query")>
<cfset ndViewFields = xmlElemNew(xmlDoc, "ViewFields")>
<cfset ndQueryOptions = xmlElemNew(xmlDoc, "QueryOptions")>
<cfset ndQuery = "<Where><BeginsWith><FieldRef Name='Name' /><Value Type='Text'>D</Value></BeginsWith></Where>">
<cfset ndViewFields = "<FieldRef Name='ID' />">
<cfset ndQueryOptions = "">
<cfset listsService.GetListItems(
"{52D3A638-FA12-44E8-9C17-5FBCD2899199}",
"",
ndQuery,
ndViewFields,
"1",
ndQueryOptions,
""
)>
<cfset ServiceResponse = GetSOAPResponse(listsService)>
<cfdump var="#ServiceResponse#">
Is the way, i try to call the webservice the right way?
Thank you, Kevin
EDIT: Thank you for your answer, I think the XML elements work.
<cfset listsService.GetListItems(
"{9BE74555-1150-4AC8-ADE7-EE52923D7CE8}",
"{1DD69D36-FD18-42B8-B57D-CCA49FD12AFE}",
ndQuery.xmlRoot,
ndViewFields.xmlRoot,
"1",
ndQueryOptions.xmlRoot,
""
)>
But now i get an "Illegal argument exception" (that's great, because it tells me, that the webservice is responding ;) ):
Cannot perform web service invocation GetListItems. The fault returned when invoking the web service operation is: '' java.lang.IllegalArgumentException: java.lang.ClassCastException@f70df9 The error occurred in D:\wwwroot\SharePoint-Tests\blog.cfm: line 83 81 : "1", 82 : ndQueryOptions.xmlRoot, 83 : "" 84 : )>
EDIT 2:
This is my new code (Avril 28.)
<cfset xmlDoc = XmlNew()>
<cfset xmlDoc.xmlRoot = xmlElemNew(xmlDoc, "xmlRoot")>
<cfset xmlDoc.xmlRoot.Query = xmlElemNew(xmlDoc, "Query")>
<cfset xmlDoc.xmlRoot.ViewFields = xmlElemNew(xmlDoc, "ViewFields")>
<cfset xmlDoc.xmlRoot.QueryOptions = xmlElemNew(xmlDoc, "QueryOptions")>
<cfset xmlDoc.xmlRoot.Query.XmlChildren[1] = xmlElemNew(xmlDoc, "Where")>
<cfset xmlDoc.xmlRoot.Query.where.XmlChildren[1] = xmlElemNew(xmlDoc, "GT")>
<cfset xmlDoc.xmlRoot.Query.where.gt.XmlChildren[1] = xmlElemNew(xmlDoc, "Value")>
0", true)> ", True)> ", True)>
#XMLFormat(ndQuery)#
#XMLFormat(ndViewFields)#
#XMLFormat(ndQueryOptions)#
<cfinvoke
webservice = "#listsService#"
method = "GetListItems"
returnvariable = "result"
timeout = "10"
>
<cfinvokeargument name="listName" value="{9BE74555-1150-4AC8-ADE7-EE52923D7CE8}">
<cfinvokeargument name="viewName" value="">
<cfinvokeargument name="query" value="#ndQuery.XmlRoot#">
<cfinvokeargument name="viewFields" value="#ndViewFields.XmlRoot#">
<cfinvokeargument name="rowLimit" value="1">
<cfinvokeargument name="queryOptions" value="#ndQueryOptions.XmlRoot#">
<cfinvokeargument name="webID" value="" omit="yes">
<!--- setting "omit" to "yes" will turn the parameter to null --->
</cfinvoke>
<cfdump var="#result#" label="result">
The errormessage is:
Cannot perform web service invocation GetListItems. The fault returned when invoking the web service operation is:
'' java.lang.IllegalArgumentException: argument type mismatch