【问题标题】:CAML Query Returning too many rowsCAML 查询返回太多行
【发布时间】:2015-06-23 20:59:38
【问题描述】:

我正在尝试构建 CAML 查询,该查询从 SharePoint 2013 列表中提取“状态”值为“已完成”的项目,但此查询返回所有列表项目,而不管“状态”的值如何。任何想法为什么会发生这种情况?

var camlQuery = new SP.CamlQuery();
camlQuery.set_viewXml(
    '<View>' +
    '<Query>' +
    '<Where>' +
    '<Geq>' +
    '<FieldRef Name=\'Status\'/>' +
    '<Value Type=\'Text\'><COMPLETED/></Value>' +
    '<RowLimit>10</RowLimit>' +
    '<Geq>' +
    '</Where>' +
    '</Query>' +
    '</View>');

【问题讨论】:

    标签: javascript sharepoint caml


    【解决方案1】:

    请检查您是否在“值”标签中输入了正确的状态值 - 没有拼写错误,不需要额外的大写或小写。就像存储在 SP 中一样使用它。 还可以尝试在查询中使用“包含”元素:

    var camlQuery = new SP.CamlQuery();
    camlQuery.set_viewXml(
        '<View>' +
        '<Query>' +
        '<Where>' +
        '<Contains>' +
        '<FieldRef Name=\'Status\'/>' +
        '<Value Type=\'Text\'>COMPLETED</Value>' +
        '<Contains>' +
        '</Where>' +
        '</Query>' +
        '<RowLimit>10</RowLimit>' +
        '</View>');
    

    祝你好运!

    【讨论】:

      猜你喜欢
      • 2015-11-12
      • 2016-06-29
      • 1970-01-01
      • 1970-01-01
      • 2015-05-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多