连接到sharepoint online时连接请求失败

时间:2013-10-23 12:22:22

标签: sharepoint groovy

我正在尝试在线连接sharepoint我使用了以下代码,但它显示的响应是请求失败。我尝试了以下代码

@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
    }
}

建议我哪里出错了。

0 个答案:

没有答案