Copy link to clipboard
Copied
I am trying to access a Sharepoint Online list from ColdFusion using the below codes:
<cfset viewFields = xmlParse(" <ViewFields> <FieldRef Name='Title'/> <FieldRef Name='Model'/></ViewFields> ")> <cfset query = xmlParse(" <Query> <OrderBy> <FieldRef Name='Title'/> </OrderBy> </Query> ")> <cfset queryOptions = xmlParse("<QueryOptions></QueryOptions>")> <cfsharepoint action="getlistitems" domain="Domain Name" name="spVar" userName="UserName" password="Password" params="#{listName="1F8473F8-7969-49F9-936D-89B8FA95DDE", viewName="818CC7AA-9B0A-4D46-A8FB-4A6C872EE064", query="#query#", rowLimit="20", viewFields="#viewFields#", queryOptions="#queryOptions#", webID="" }#" /> <cfset results="#spVar.listitems.data#"> <h1>Site Punch List</h1> <ul> <cfloop index="i" from="1" to="#arrayLen(results)#"> <li><cfoutput>#results[i].ows_Title#</cfoutput></li> </cfloop> </ul> </td> </tr>
Using the above code, I tried to use Cold Fusion to access a list on our Sharepoint Online site.
However, when I run the above code, I got the below error
"Error","ajp-nio-8016-exec-8","10/17/19","10:12:32","INTRANET","Cannot perform web service invocation getlistitems.The fault returned when invoking the web service operation is:<br> <pre>AxisFault faultCode: {http://xml.apache.org/axis/}HTTP faultSubcode: faultString: (403)Forbidden faultActor: faultNode: faultDetail: {}:return code: 403 403 FORBIDDEN {http://xml.apache.org/axis/}HttpErrorCode:403 ''</pre> The specific sequence of files included or processed is: #My file name# line: 179 "
Any idea? The error looks like username/password error, but I use the same username/password to login to the Domain Name.
Thanks!
dc7669
Copy link to clipboard
Copied
I have zero experience with sharepoint, but even so I'd question why you are using xmlparse here. Do you realize what that does? It converts those xml strings into an internal CF-specific representation of the XML. That's great for then "parsing" it in CF (try doing a cfdump of viewfields to see how complex a structure it becomes).
But you are then passing that variable as an argument to cfsharepoint--and I wouldn't be surprised if it wants just the XML, as-is, not this CFML-internal representation of it. That may be why the destination fails with the 403. Have you tried simply removing the xmlparse, so that the variable as passed in has the XML just as a simple string?
Indeed, how did you come up with this code? Did you find it offered as a working example of how to call sharepoint from CF? Can you share a link to it? Maybe we (or you) could better then see if there's an issue like I assert above.
Copy link to clipboard
Copied
The code template I found are: http://existdissolve.com/2009/07/cfsharepoint-yes/ and https://bdking71.wordpress.com/2016/06/23/coldfusion-2016s-cfsharepoint-tag/.
When I put "<cfdump var="#spVAR#"> to replace how the results are displayed at the end, the error was the same.
I have not idea what xmlparse does.
Thanks for the input.