Stack Exchange
Connection request failed while connecting to sharepoint online
I am trying to connect sharepoint online i used the following code but the response it is showing is request failed . I tried the following code
@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.*;
import groovyx.net.http.HTTPBuilder;
import static groovyx.net.http.Method.GET;
import static groovyx.net.http.ContentType.TEXT;
import groovyx.net.http.RESTClient
import groovy.util.slurpersupport.GPathResult
import static groovyx.net.http.ContentType.URLENC
import groovyx.net.http.URIBuilder

def authSite = new HTTPBuilder( 'https://xyzsharepoint.com' );
authSite.auth.basic 'username', 'password';
authSite.request(GET) { req->
    response.success = { resp->
        println'request was successful'
        assert resp.status<400
    }
    response.failure = { resp ->
        println'request failed'
        assert resp.status>=400
    }
}

Suggest me where I went wrong. 

What do the sharepoint logs say?

@tim_yates I did not check sharepoint logs yet but what could be the problem I tried in several ways resulting in failures linke ,Forbidden,Socketclosed and connection reset.Do you have any idea or resource to do pull the sharepoint list values.Suggest me an idea.Thank you.

I don't know, I don't use sharepoint, however the sharepoint logs are the first place I'd look

I realise this is the same advice that was offered to you 2 days ago on the groovy mailing list

Hey is that you?Any ways i will look into sharepoint logs and will get back to you Thank you for the reply tim_yates.I am trying a lot to pull the List values from sharepoint online but no luck . I will get back to you after checking sharepoint logs

No, that was Jochen, the lead groovy dev guy..  Fingers crossed the logs reveal some useful info :-)

Yes I will check sharepoint logs for sure and will get back to you on the same post .Thank you for the reply @tim_yates
