SharePoint CAML或

时间:2018-07-01 20:45:14

标签: sharepoint caml

我如何将此SQL编写为CAML?

CurrentDate = Now()
StartDate = '1-1-2018 12:00 AM'
EndDate = '1-1-2018 11:59 PM'

SELECT * FROM Calendar as c
WHERE (c.EventDate <= CurrentDate AND c.EndDate >= CurrentDate)
    OR (c.EventDate <= StartDate AND c.EndDate <= EndDate)

This link看起来不错,但不能满足我的要求。

这是我拥有的CAML,但是它不起作用,我收到未定义的错误:

<View>
  <Query>
    <Where>
      <Or>
        <Leq><FieldRef Name='EventDate' /><Value StorageTZ='TRUE' IncludeTimeValue="FALSE" Type="DateTime">2018-07-01T00:00:00-0400</Value></Geq>
        <Geq><FieldRef Name='EndDate' /><Value StorageTZ='TRUE' IncludeTimeValue="FALSE" Type="DateTime">2018-07-01T00:00:00-0400</Value></Leq>
          <Or>
              <Leq><FieldRef Name='EventDate' /><Value StorageTZ='TRUE' IncludeTimeValue="FALSE" Type="DateTime">2018-07-01T00:00:00-0400</Value></Leq>
              <Geq><FieldRef Name='EndDate' /><Value StorageTZ='TRUE' IncludeTimeValue="FALSE" Type="DateTime">2018-07-01T23:59:59-0400</Value></Geq>
          </Or>
      </Or>
    </Where>
   </Query>
</View>

1 个答案:

答案 0 :(得分:1)

使用下面的CAML查询。

<input type="text" class="form-control" id="wallet" name="wallet" value="{{old('wallet') or 0}}">

这里是SharePoint CAML查询设计器工具,供您参考。 https://github.com/konradsikorski/smartCAML