使用Groovy Script提取Sharepoint 2010 Cloud List值时出现403 Forbidden Error

时间:2013-10-11 06:05:02

标签: http rest sharepoint grails groovy

我正在尝试使用groovy脚本来提取sharepoint2010 Cloud List值。但是我遇到了403 Forbidden错误。我是Sharepoint2010 Cloud和Groovy的新手。我尝试了以下代码,导致403错误。

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

我需要以XML的形式提取List值。这是正确的做法吗?请在出错的地方帮助我。提前谢谢。

0 个答案:

没有答案