Sharepoint学习笔记—ECMAScript对象模型系列-- 3、如何查看SP object的所有方法(method) - 图文
更新时间:2023-12-01 19:44:01 阅读量: 教育文库 文档下载
在使用ECMAscript对象模型开发应用时,我们不自觉的想要知道某个SP object都提供了什么方法?这里我们就来看看怎么做。
1、在我们前面建立的Sharepoint项目中,新增一个Visual WebPart(命名为WPLkECMAscript)和一个Javascript文件(命名为ECMAOpListItems.js) ECMAOpListItems.js的代码如下,这段代码我们在前面的介绍中用到,主要用于提取WebSite的属性
//Retrive Website Properties var siteUrl = '/';
function retriveWebSiteProperties() {
var clientContext = new SP.ClientContext(siteUrl);
// var clientContext= new SP.ClientContext.get_current(); this.oWebsite = clientContext.get_web();
clientContext.load(this.oWebsite, 'Title', 'Created'); //Load the specific properties of website object clientContext.executeQueryAsync(Function.createDelegate(this, this.onQuerySucceededProperties), Function.createDelegate(this, this.onQueryFailedProperties)); }
function onQuerySucceededProperties(sender, args) {
alert('Title: ' + this.oWebsite.get_title() + ' Created: ' + this.oWebsite.get_created()); // alert('Title'); }
function onQueryFailedProperties(sender, args) {
alert('Request failed. ' + args.get_message() + '\\n' + args.get_stackTrace()); // alert('Failed'); }
在WPLkECMAscript的WPLkECMAscript.cs中注册我们上面加入的ECMAOpListItems.js,代码如下:
using System;
using System.ComponentModel; using System.Web; using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts; using Microsoft.SharePoint;
using Microsoft.SharePoint.WebControls;
namespace JsomTest.WPLkECMAscript {
[ToolboxItemAttribute(false)]
public class WPLkECMAscript : WebPart {
// Visual Studio might automatically update this path when you change the Visual Web Part project item.
private const string _ascxPath = @\;
protected override void CreateChildControls() {
Control control = Page.LoadControl(_ascxPath); Controls.Add(control);
ScriptLink.Register(this.Page, \, true); } } }
而WPLkECMAscript界面中我们添加了一个按钮来激活上面的功能,代码如下:
项目下所示:
2、在Sharepoint网站中添加上述开发的Visual WebPart,并运行Sharepoint应用,当应用界面显示时,所示如下图
3、调用IE的Developer Tools工具,如下
4、选中Developer Tools的Script页
- exercise2
- 铅锌矿详查地质设计 - 图文
- 厨余垃圾、餐厨垃圾堆肥系统设计方案
- 陈明珠开题报告
- 化工原理精选例题
- 政府形象宣传册营销案例
- 小学一至三年级语文阅读专项练习题
- 2014.民诉 期末考试 复习题
- 巅峰智业 - 做好顶层设计对建设城市的重要意义
- (三起)冀教版三年级英语上册Unit4 Lesson24练习题及答案
- 2017年实心轮胎现状及发展趋势分析(目录)
- 基于GIS的农用地定级技术研究定稿
- 2017-2022年中国医疗保健市场调查与市场前景预测报告(目录) - 图文
- 作业
- OFDM技术仿真(MATLAB代码) - 图文
- Android工程师笔试题及答案
- 生命密码联合密码
- 空间地上权若干法律问题探究
- 江苏学业水平测试《机械基础》模拟试题
- 选课走班实施方案
- Sharepoint
- ECMAScript
- 模型
- 对象
- 图文
- 所有
- 笔记
- 方法
- 系列
- object
- method
- 如何
- 学习
- 查看
- 蓝牙耳机市场前景调查分析报告
- 六一串词
- 2017年三年级上册背诵篇目(新)
- 地质学三四章的答案
- 幼儿园食堂各项管理制度
- 钢桥题
- 2012级《会计基础》 复习提纲(1)
- 吉利并购沃尔沃利弊分析及中国企业跨国并购对策Microsof
- 7. 2018青浦初三英语二模卷 - 图文
- 寄语大全之孩子十岁家长寄语
- 《齐桓晋文之事》原文及翻译
- 2021北京航空航天大学道路与铁道工程考研真题经验参考书
- 自粘防水卷材施工方案 - 图文
- 归有光笔下的张贞女事件
- 四年级下语文教案-1种子语文s版
- 2014国家公务员考试行测模拟试卷参考答案 - 图文
- 袁行霈中国文学史四卷本习题集
- RSI极地上涨 日周月RSI 自用RSI指标通达信指标公式源码
- 长寿区乡村道路养护管理实施办法(试行)
- 过秦论理解性默写答案