2

この CAML クエリを手伝ってくれる人はいますか? Ascending属性を からTRUEに反転すると (およびFALSEも試しました)、結果セットの順序が変更されません。 TrueFalse

CAML の残りの部分は正しく、ツールによって生成され、適切な結果が返されています。

<Where>
  <And>
    <And>
      <Eq>
        <FieldRef Name="Branch"/>
        <Value Type="Text">Camp 1</Value>
      </Eq>      
      <Eq>
        <FieldRef Name="Type"/>
        <Value Type="Choice">Day</Value>
      </Eq>
    </And>
    <Geq>
      <FieldRef Name="StartDateTime"/>
      <Value Type="DateTime">2009-01-05T00:00:00Z</Value>
    </Geq>
  </And>
  <OrderBy>
    <FieldRef Ascending="TRUE" Name="Title" />
  </OrderBy>
</Where>
4

3 に答える 3

9

OrderBy は Where 句の外にある必要はありませんか?

    <Where>
  <And>
    <And>
      <Eq>
        <FieldRef Name="Branch"/>
        <Value Type="Text">Camp 1</Value>
      </Eq>      
      <Eq>
        <FieldRef Name="Type"/>
        <Value Type="Choice">Day</Value>
      </Eq>
    </And>
    <Geq>
      <FieldRef Name="StartDateTime"/>
      <Value Type="DateTime">2009-01-05T00:00:00Z</Value>
    </Geq>
  </And>
  </Where>
<OrderBy>
    <FieldRef Ascending="TRUE" Name="Title" />
  </OrderBy>

http://msdn.microsoft.com/en-us/library/ms442728.aspxを参照してください。

于 2009-02-27T10:33:47.993 に答える
4

上記の回答に同意します。<Query> は <Where> の外にある必要があります。また、DateTime フィールドと比較する場合、通常は IncludeTimeValue 属性を含めることをお勧めします。

<Geq>
      <FieldRef Name="StartDateTime"/>
      <Value Type="DateTime" IncludeTimeValue="FALSE">2009-01-05T00:00:00Z</Value>
</Geq>

クエリに時間値を含めるかどうかに応じて、false または true に設定します。

于 2009-02-27T11:29:26.987 に答える