六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 249|回复: 0

SPServices Document Library 查询某个文档

[复制链接]

升级  58%

7

主题

7

主题

7

主题

童生

Rank: 1

积分
29
 楼主| 发表于 2013-1-6 05:18:13 | 显示全部楼层 |阅读模式
<div id="cnblogs_post_body">
使用jquery.SPServices查询文档库里的某一个文档,需要设置CAMLQueryOptions属性,<ViewAttributes Scope="RecursiveAll" />才能查询出来,取值的时候需要使用SPFilterNode("z:row")

<div class="cnblogs_code">        $().SPServices({            operation: "GetListItems",            async: false,            listName: "Test Documents",            CAMLQuery: "<Query><Where><Eq><FieldRef Name='ID' /><Value Type='Counter'>" +strID+ "</Value></Eq></Where></Query>",            CAMLQueryOptions:'<QueryOptions><ViewAttributes Scope="RecursiveAll" /></QueryOptions>',            CAMLRowLimit: 1,            CAMLViewFields: "<ViewFields><FieldRef Name='YourField' /><FieldRef Name='ID' /></ViewFields>",            completefunc: function(xData, Status) {                $(xData.responseXML).SPFilterNode("z:row").each(function(i) {                    if($(this).attr("ows_YourField")!='' && $(this).attr("ows_YourField") != null && $(this).attr("ows_YourField") != 'undefined'){                        YourField = $(this).attr("ows_YourField");                    }                });            }        });
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表