How to Call SharePoint 2013 API

In SharePoint 2013, we can query the list by it owner service, then dynamic load the info of the list items to render in client.

Here is the require, dynamic load the info about the list named link and show to the page in datail.

Here is my steps:

1. Create a link list named "Links", and create a column named "Category", the column is use for category the links, and filter the items. the add some items.

2.  Edit the page that you want to show the Links list items. and add the webpart named Script Edittor to store the js code. then edit the webpart and add the js code into the webpart.

Here is the code:

<script src="http://code.jquery.com/jquery-1.10.2.js"></script>  
</script>
 
$(document).ready(function () {
ExecuteOrDelayUntilScriptLoaded(getLinksInfo, "sp.js");
});
function getLinksInfo() { var requestUri = "http://dev-sp"+ "/_api/Web/Lists/getByTitle('Links')/items";
var ulIcons = $("#test"); $.ajax({
url: requestUri,
type: "GET",
headers: { "ACCEPT": "application/json;odata=verbose" },
success: function (data) { var items = "";
$.each(data.d.results, function (index) {
switch ($(this).attr("Category")) {
case "Operations":
items += "<li><a href='mailto:" + $(this)[0].URL.Url+ "'>" + $(this)[0].URL.Description + " - Operation" + "</a></li>"
break;
case "Marketing":
items += "<li><a href='" + $(this)[0].URL.Url + "'>" + $(this)[0].URL.Description + " - Markrting" + "</a></li>"
break;
} }); if (items != "") {
ulIcons.html("");
ulIcons.html(items);
}
},
error: function (e) {
alert("Failed to get Escalations Icons!");
}
});
} </script>

3. Clicke "Ok" abdou the script webpart and save the page. It wiil show the result

How to Call SharePoint 2013 API Service to Query The Lists的更多相关文章

  1. SharePoint 2013 - REST Service

    0. SharePoint 2013使用_api来标识出 REST SERVICE,REST Service其实是 client.svc web service的一部分,但为了简化 REST URI的 ...

  2. SharePoint 2013 安装 Service Pack 1

    Problem 当迁移SharePoint 的时候,执行Move-SPSite 命令,将指定的Site Collection移动到目标内容数据库中时,提示以下错误:Cannot complete th ...

  3. SharePoint REST api

    http://msdn.microsoft.com/en-us/magazine/dn198245.aspx Understanding and Using the SharePoint 2013 R ...

  4. 修复SharePoint 2013 Search 拓扑错误

    Problem 当创建和配置SharePoint 2013 Search Service Application成功之后,进入详细配置页后,在Search Application Topology节点 ...

  5. SharePoint 2013中的爬网最佳做法

    了解在 SharePoint Server 2013 中爬网的最佳做法 搜索系统对内容进行爬网,以构建一个用户可以对其运行搜索查询的搜索索引.本文包含有关如何最有效地管理爬网的建议. 本文内容: 使用 ...

  6. SharePoint 2013 APP 开发示例 (六)服务端跨域访问 Web Service (REST API)

    上个示例(SharePoint 2013 APP 开发示例 (五)跨域访问 Web Service (REST API))是基于JavaScript,运行在web browser内去访问REST AP ...

  7. SharePoint 2013 APP 开发示例 (五)跨域访问 Web Service (REST API)

          虽然 JQuery 也能通过授权header实现跨域, 但SharePoint 提供了更简单的方法,它被实现在SP.RequestExecutor里 .它能访问跨域的服务包括REST AP ...

  8. SharePoint 2013 Search REST API 使用示例

    前言:在SharePoint2013中,提供Search REST service搜索服务,你可以在自己的客户端搜索方法或者移动应用程序中使用,该服务支持REST web request.你可以使用K ...

  9. 在 SharePoint 2013 中选择正确的 API 集

    决定使用哪个 API 集的因素   您可以在多个 API 集中选择一个来访问 SharePoint 2013 平台.您使用哪一个 API 集取决于以下因素: 应用程序的类型. 可能的类型包括但不限于以 ...

随机推荐

  1. maximo功能修改(初步理解)

    已接触IBM公司的MAXIMO近三个月,在这时间里自己对maximo也有所了解,今天将自己总结写在这里,方便自己的温习和大家的参考,不足之处还望指出,我一定在第一时间内修改. 今天在公司所做的就是完善 ...

  2. Bootstrap修改input file默认样式

    html部分 <div class="form-group"> <label class="col-sm-3 control-label"&g ...

  3. python生成中文验证码,带旋转,带干扰噪音线段

    # -*- coding: utf-8 -*- """ Created on Sun Oct 4 15:57:46 2015 @author: keithguofan & ...

  4. Android之下拉刷新,上啦加载的实现(一)

    转载地址http://blog.csdn.net/leehong2005/article/details/12567757#t5 前段时间项目中用到了下拉刷新功能,之前在网上也找到过类似的demo,但 ...

  5. Objective c, +load, +initialize 方法

    +load() 当类被加载入程序的时候会执行+load方法 +initialize() 当类第一次被使用的时候会执行+initialize方法 这两个方法都只会被执行一次.

  6. Hibernate的配置文件以及用法

    一. 三大框架 Hibernate 1.安装hibernate插件至ecilpse 2.进行配置 2.1 主配置文件 <?xml version="1.0" encoding ...

  7. 2016 ICPC北京站现场赛总结(再度流水账)

    其他的都先不说,北大的未名湖真的美! 虽然感觉北大其他地方都有些破旧之感,但是未名湖附近真的值得称赞. 在去北京之前就听说北京温度很低,不过是干冷,果不其然.北京不冷,就是嘴唇太干了,不喝水真的受不了 ...

  8. RedHat下编译安装Boost

    1.解压boost_1_54_0.tar.gz 2.进入目录后,运行 ./bootstrap.sh ,会生成一个 bjam 的可执行程序 3.运行 ./bjam release install 进行编 ...

  9. ExtJs弹出窗口

    1.Ext.Msg.alert(String title, String msg, [Function fn], [Object scope]) 显示一个标准的带有一个"确定"按钮 ...

  10. Selenium2+python自动化5-操作浏览器基本方法

    前言 前面已经把环境搭建好了,这从这篇开始,正式学习selenium的webdriver框架.我们平常说的 selenium自动化,其实它并不是类似于QTP之类的有GUI界面的可视化工具,我们要学的是 ...