使用jquery.SPServices查询文档库里的某一个文档,需要设置CAMLQueryOptions属性,<ViewAttributes Scope="RecursiveAll" />才能查询出来,取值的时候需要使用SPFilterNode("z:row")

 

        $().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");
                    }
                });
            }
        });

 

 

 

相关文章:

  • 2021-07-03
  • 2022-12-23
  • 2021-05-30
猜你喜欢
  • 2021-07-13
  • 2022-12-23
  • 2022-12-23
  • 2021-11-05
  • 2021-05-11
  • 2021-05-25
  • 2022-03-06
相关资源
相似解决方案