SPServices Document Library 查询某个文档
使用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"); } }); } });