I am not finding a way regarding how to connect to sharepoint 2010 cloud and read a list using groovy scrip .I googled a lot but did not find any clue.Kindly suggest me an idea or any resource how to do that? Thanks in advance.
Asked
Active
Viewed 685 times
0
-
What type of endpoint does sharepoint expose, web service, SOAP, REST? – raffian Oct 09 '13 at 15:51
-
@raffin : It is RESTservice so i am not finding any clue how to do that regarding how to connect to sharepoint cloud 2010 and pull the list details in the format of xml . please provide me any idea or resource .What is the best way to do that ?Thanks in advance – gshashank Oct 10 '13 at 06:39
1 Answers
0
Easiest way to test in Groovy:
String restUrl = "http://sharepoint/myrestendpoint"
println( url.toURL().text)
Refer to this for a more formal approach:
http://groovy.codehaus.org/GroovyWS

raffian
- 31,267
- 26
- 103
- 174
-
where to give username and password and how to pull the contents in a sharepointlist please give me an idea .Thanks in advance – gshashank Oct 11 '13 at 05:08
-
Follow instructions here: http://groovy.codehaus.org/modules/http-builder/doc/auth.html, hope it helps! – raffian Oct 11 '13 at 05:11
-
I tried the following code pull the particular list values in the form of XML @Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.5.0-RC2' ) import groovyx.net.http.* import static groovyx.net.http.ContentType.* import static groovyx.net.http.Method.* def authSite = new HTTPBuilder( 'mysharpoint.com' ) authSite.auth.basic 'username', 'password' String restUrl = "mysharepoint/List"println( restUrl.toURL().text)println"success" but encountered with 403 error is this the right way what i am doing?? – gshashank Oct 11 '13 at 05:35
-
Try connecting to a website without authentication, to test groovy http builder; once that's working, then try with authentication. `403` means the server took the request but denied access to the resource. – raffian Oct 11 '13 at 13:50
-
-
You have to find one; run a web server on localhost or connect to yahoo.com, whatever, just use any URL without authentication. – raffian Oct 13 '13 at 15:25
-
yes it is working for sites without authentication but it is failing to pull the sharepoint list .It is showing 403 for the Specified List URL @raffian – gshashank Oct 15 '13 at 04:49
-
Check for URL errors and make sure you're specifying an actual web page file name and extension, not just a directory. 403 means you're attempting to access a resource that's forbidden; authentication has nothing to do with it. – raffian Oct 15 '13 at 14:00
-
@Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.5.0-RC2' ) import groovyx.net.http.* import static groovyx.net.http.ContentType.* import static groovyx.net.http.Method.* def authSite = new HTTPBuilder( 'https://mysharepointwebsite' ) authSite.auth.basic 'username', 'password' String restUrl="https://mysharepointwebsite/site/_vti_bin/listdata.svc/Listname" println(restUrl.toURL().text) I am getting Forbidden error @restUrl@raffain but i am able to access it in browser – gshashank Oct 15 '13 at 17:18