sharepoint-2013 - 将数据从一个网站集获取到同一 Web 应用程序共享点 2016 中的另一个网站集
问题描述
我在本地使用 SharePoint 2016。我有一个 Web 应用程序,其中有 2 个网站集。站点 1 和站点 2。我想使用 rest 或 java 脚本或 J 查询在站点集合 2 页面上显示站点集合 1 列表中的数据。我的环境没有配置应用程序,所以我不能使用应用程序甚至服务器端代码。请建议这样做的任何替代方案。
提前致谢。
解决方案
Share the script here in case someone have similar requirement.
<script>
$(function () {
getDataFromSite1();
getDataFromSite2();
})
function getDataFromSite1() {
var url = "http://sp:12001/_api/web/lists/GetByTitle('MyList')/items";
$.ajax({
async: false,
url: url,
method: "GET",
headers: {
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose"
},
success: function (data) {
console.log(data)
},
error: function (data) {
}
});
}
function getDataFromSite2() {
var url = "http://sp:12001/sites/team/_api/web/lists/GetByTitle('MyList')/items";
$.ajax({
async: false,
url: url,
method: "GET",
headers: {
"accept": "application/json;odata=verbose",
"content-type": "application/json;odata=verbose"
},
success: function (data) {
console.log(data)
},
error: function (data) {
}
});
}
</script>
推荐阅读
- python - 根据状态向 DataFrame 添加具有百分比数量的新列
- javascript - 如何在 mdl 菜单选择中显示动态值
- clang - clang 序列化 AST 是否可移植?
- javascript - 如何开玩笑地模拟 const 对等
- c# - Xamarin android 下载在第二次尝试后挂起
- reactjs - React Bootstrap ToggleButtonGroup 和多选
- c# - asp-all-route-data 未在 Asp.Net Core MVC 中调用操作方法
- graph - 如何解释这个 Cypher 查询的执行路径?
- node.js - 发送电子邮件错误:错误:无效登录:454 4.7.0 登录尝试次数过多,请稍后再试。b18sm2198190pgk.36 - gsmtp
- javascript - 无法识别 iframe 中的量角器元素