【发布时间】:2016-07-02 07:20:35
【问题描述】:
我尝试使用本地主机中部署的应用程序中的共享点休息 API。 Sharepoint 网站托管在 Sharepoint 2013 在线版中。
为此,我使用 javascrpt 跨域库。我在这里有一个例子https://github.com/OfficeDev/SharePoint-Add-in-REST-OData-CrossDomain。
我的应用程序是一个全静态网站,我没有VS,所以我试图弄清楚Add In 授权。我去我网站的_layouts/15/appinv.aspx页面授权第三方应用:
- 应用域名:localhost:8080
- 重定向网址:http://localhost:8080(毫无意义?)
- 权限请求 XML:
<AppPrincipal><RemoteWebApplication ClientId="*" /></AppPrincipal>
当我转到我的应用程序时,我已使用我的帐户进行身份验证:cookie 填充有 FedAuth 和 rtFa 中的令牌
我认为现在使用 API 应该足够了:
var executor = new SP.RequestExecutor(addinweburl);
executor.executeAsync(
{
url:
addinweburl + "/_api/web/GetFolderByServerRelativeUrl('Shared%20Documents')"
,
method: "GET",
headers: { "Accept": "application/json; odata=verbose" },
success: function(e) {
alert('success');
},
error: function(e, c, d) {
alert('fail');
}
}
);
调用错误处理程序并发送 1007 错误代码。这很奇怪,因为当大小太重要时会使用此代码。
感谢任何帮助。
【问题讨论】:
标签: web-services rest sharepoint sharepoint-2013