This project has moved. For the latest updates, please go here.

How to set Value attributes?

Jul 21, 2014 at 9:52 AM
Hi,

how can i set something like this with Camlex.NET?

<Value Type='DateTime' IncludeTimeValue='True'></Value>

with kind regards

Patrick
Coordinator
Jul 22, 2014 at 11:09 AM
hi,
you should use DateTime's extension method IncludeTimeValue() declared in Camlex for this:
string s = Camlex.Query().Where(x => (DateTime)x["Foo"] == DateTime.Now.IncludeTimeValue()).ToString();
It will give the following CAML:
<Where>
  <Eq>
    <FieldRef Name="Foo" />
    <Value Type="DateTime" IncludeTimeValue="True">2014-07-22T14:07:54Z</Value>
  </Eq>
</Where>