jsom sharepoint 2010 循环获取多个list的item值
- <script type="text/javascript">
- // <![CDATA[
- var chongdianbaId;
- var elm = document.getElementById("idAttachmentsTable");
- var elmAttachmentRow = document.getElementById("idAttachmentsRow");
- if ((elm == null || elm.rows.length == 0) && (elmAttachmentRow!=null)){
- elmAttachmentRow.style.display='none';
- }else{
- var attachmenturl = GetAttachmentsUrl().split(";")[0];
- chongdianbaId = attachmenturl.split("/")[7];
- ExecuteOrDelayUntilScriptLoaded(GetChongDianBaName,"SP.js");
- }
- //获取附件url地址集合
- function GetAttachmentsUrl(){
- var urls;
- var locUrl = window.location.href;
- if (locUrl.indexOf("doccenter/Lists/List1/DispForm.aspx") != -1){
- var td = elm.getElementsByTagName("td");
- var len = td.length;
- for (i = 0; i < len; i++) {
- var a = td[i].getElementsByTagName("a")
- urls += a[0].href + ";";
- }
- }
- return urls;
- }
- //获取充电吧标题
- var chongdianbaName;
- var chongdianba;
- function GetChongDianBaName() {
- var ctx = new SP.ClientContext.get_current();
- var web = ctx.get_web();
- var list = web.get_lists().getByTitle("充电吧");
- var camlQuery = new SP.CamlQuery();
- camlQuery.set_viewXml('<View><Query><Where><Contains><FieldRef Name=\'ID\'/>' + '<Value Type=\'Counter\'>'+ chongdianbaId + '</Value></Contains></Where></Query><RowLimit>10</RowLimit></View>');
- this.chongdianba = list.getItems(camlQuery);
- ctx.load(this.chongdianba, "Include(Title)");
- ctx.executeQueryAsync(Function.createDelegate(this,this.onSuccess0),Function.createDelegate(this,this.onFailed0));
- }
- function onSuccess0(sender, args) {
- var count = 0;
- var listEnumerator = this.chongdianba.getEnumerator();
- while (listEnumerator.moveNext()) {
- count = count + 1;
- var currentItem = listEnumerator.get_current();
- chongdianbaName += currentItem.get_item('Title').toString();
- }
- chongdianbaName = chongdianbaName.replace('undefined','');
- alert(chongdianbaName);
- ExecuteOrDelayUntilScriptLoaded(GetAttachmentFolderName,"SP.js");
- }
- function onFailed0(sender, args) {
- alert('failed. Message:' + args.get_message());
- }
- //获取KnowledgeLibrary内容
- var folderName;
- var knowledgeLibrary;
- function GetAttachmentFolderName() {
- var ctx = new SP.ClientContext("/");
- var web = ctx.get_web();
- var list = web.get_lists().getByTitle("KnowledgeLibrary");
- var camlQuery = new SP.CamlQuery();
- camlQuery.set_viewXml('<View><Query><Where><Contains><FieldRef Name=\'Title\'/>' + '<Value Type=\'Text\'>'+ chongdianbaName + '</Value></Contains></Where></Query><RowLimit>10</RowLimit></View>');
- this.knowledgeLibrary = list.getItems(camlQuery);
- ctx.load(this.knowledgeLibrary, "Include(dtAttachmentFolderName,dtAttachmentListName)");
- ctx.executeQueryAsync(Function.createDelegate(this,this.onSuccess),Function.createDelegate(this,this.onFailed));
- }
- function onSuccess(sender, args) {
- var count = 0;
- var listEnumerator = this.knowledgeLibrary.getEnumerator();
- while (listEnumerator.moveNext()) {
- count = count + 1;
- var currentItem = listEnumerator.get_current();
- folderName += currentItem.get_item('dtAttachmentFolderName').toString();
- }
- folderName = folderName.replace('undefined','')
- alert(folderName);
- ExecuteOrDelayUntilScriptLoaded(GetAttachmentItemID,"SP.js");
- }
- function onFailed(sender, args) {
- alert('failed. Message:' + args.get_message());
- }
- //获取附件id
- var attachmentFiles;
- var attachmentIDs;
- function GetAttachmentItemID() {
- var ctx = new SP.ClientContext("/");
- var web = ctx.get_web();
- var attachmentFolder = web.getFolderByServerRelativeUrl('/DentsuDocumentLibraryAttachments/' + folderName);
- this.attachmentFiles = attachmentFolder.get_files();
- ctx.load(this.attachmentFiles);
- ctx.executeQueryAsync(Function.createDelegate(this,this.onSuccess1),Function.createDelegate(this,this.onFailed1));
- }
- function onSuccess1(sender, args) {
- var listEnumerator = this.attachmentFiles.getEnumerator();
- while (listEnumerator.moveNext()) {
- var currentItem = listEnumerator.get_current();
- attachmentIDs += currentItem.get_item('ID').toString() + ';';
- }
- alert(attachmentIDs);
- }
- function onFailed1(sender, args) {
- alert('failed. Message:' + args.get_message());
- }
jsom sharepoint 2010 循环获取多个list的item值的更多相关文章
- sharepoint 2010 中获取system账号的真实账号
在使用sharepoint的时候有的时候需要在后台获取当前登录用户的登录名,一般的时候使用SPContext.Current.Web.CurrentUser就可以了,但是有一个特殊的用“系统账户”,获 ...
- selenium,统计某分支下有多少个同类子分支的方法(用于循环获取同类型子分支属性值)
利用selenium自动化统计微博阅读数 查看微博阅读数的元素路径 微博列表中第一条微博的元素路径“//*[@id="Pl_Official_MyProfileFeed__20"] ...
- python 3.6闭包+循环获取出字典中所有的值并保存在list中
def list_test(): list1=[] def list_all_dict(a): #检测字段类型 if isinstance(a,dict): for x in range(len(a) ...
- SharePoint 2010 获取当前用户的权限
转:http://blog.csdn.net/sygwin_net/article/details/6790500 操作环境:SharePoint 2010 关于SharePoint 的权限架构,具体 ...
- 在 SharePoint 2010 中访问数据
转:http://blog.banysky.net/?p=81001 数据访问的关键方法有哪些? | 使用查询类 | 使用 SPQuery | 使用 SPSiteDataQuery | 使用 LINQ ...
- 在SharePoint 2010中,如何找回丢失的服务账号(Service Account)密码
背景信息: 通常在SharePoint环境中我们会使用很多的服务账号来运行各种不同的服务,尤其在企业环境中,由于权限管理条例严格,这些服务账号更是只能多不能少.面对如此多的服务账号,各个企业都会有自己 ...
- SharePoint 2010商业智能组件
Microsoft Office SharePoint Server (MOSS) 2007中,就已经提供了很多支持商业智能的能力.其中主要的组件包含Excel Services, Reporting ...
- SharePoint 2010 文档管理之过期归档工具
前言:使用过SharePoint的人都知道,SharePoint对于操作是便捷的,但是对于数据量承载却是不令人满意的,这样,就要求我们需要更加合理的使用,规范大家的使用规则和习惯,所以,定期清理不必要 ...
- SharePoint 2010 最佳实践学习总结------第1章 SharePoint Foundation开发基础
----前言 这段时间项目出在验收阶段,不是很忙,就潜心把SharePoint学一下,不求有多深刻,初衷只是先入门再说.后续会发布一系列的学习总结.主要学习的书籍为<SharePoint2010 ...
随机推荐
- Android 软件开发之如何使用Eclipse Debug调试程序详解及Eclipse常用快捷键(转)
1.在程序中添加一个断点如果所示:在Eclipse中添加了一个程序断点 在Eclipse中一共有三种添加断点的方法 第一种: 在红框区域右键出现菜单后点击第一项 Toggle Breakpoint 将 ...
- Windows Azure Cloud Service (47) 修改Cloud Service时区
<Windows Azure Platform 系列文章目录> 本文介绍内容适合于Azure Global和Azure China 我们在使用Cloud Service的时候,会发现默认的 ...
- SQL Server安全(3/11):主体和安全对象(Principals and Securables)
在保密你的服务器和数据,防备当前复杂的攻击,SQL Server有你需要的一切.但在你能有效使用这些安全功能前,你需要理解你面对的威胁和一些基本的安全概念.这篇文章提供了基础,因此你可以对SQL Se ...
- html5和css3的常用参考网
当我们使用HTML5, CSS3,甚至Bootstrap设计网站的时候,有些方面是必须考虑的,比如字体大小,标题大小,行间距,每行字数,字体,颜色,背景图片和文字的搭 配,图标,留白和布局...... ...
- C#序列化s实体类成Xml,去除空格、换行符以及命名空间
序列化实体类成为一个干净的Xml,不带空格.换行符以及命名空间 /// <summary> /// 序列化成XML /// </summary> /// <typepar ...
- 瀑布式开发、迭代开发、敏捷开发、XP与SCRUM的区别
瀑布式开发.迭代开发,区别[都属于,生命周期模型] 两者都是一种开发模式,就像设计模式一样,考虑的角度不一样,个人感觉谈不到取代一说. 传统的瀑布式开发,也就是从需求到 ...
- 开始MS SQL Server 2016之旅
下班前一刻,把MS SQL Server 2016安装好,国庆回来之后,就可以学习之旅......
- Winform混合式开发框架的特点总结
Winform混合式开发框架,是一种支持分布式部署的应用模式,支持直接连接数据库,访问远程WCF服务,访问远程Web API服务等服务的综合性框架,根据不同的需求采用不同的数据接口,是一个适应性很广的 ...
- .net的垃圾回收机制简述
.如何理解.net中的垃圾回收机制. .NET Framework 的垃圾回收器管理应用程序的内存分配和释放.每次您使用 new 运算符创建对象时,运行库都从托管堆为该对象分配内存.只要托管堆中有地址 ...
- MVC的路径查找顺序
使用MVC的朋友们,知道MVC的funny之处. 但是如果出现路径找不到,请记住以下的页面路径寻找顺序. http://www.cnblogs.com/sosoft/ 首先,知道你的Controlle ...