CAML query to get all items across all folders
<QueryOptions>
<QueryOptions>
<ViewAttributes Scope="RecursiveAll" />
</QueryOptions>
Or
query.ViewAttributes = "Scope=\"Recursive\"";
UserID for current user (here example for Author and Editor)
<Where>
<Or>
<Eq>
<FieldRef Name="Author" />
<Value Type="Integer">
<UserID />
</Value>
</Eq>
<Eq>
<FieldRef Name="Editor" />
<Value Type="Integer">
<UserID />
</Value>
</Eq>
</Or>
</Where>
UTC, Date Time format,
ISO Caml date time format,
ISO Caml date time format,
yyyy-MM-ddThh=mm-sss
Offset "-10"
<Where>
<Eq>
<FieldRef Name="DueDate" />
<Value Type="DateTime">
<Today />
</Value>
</Eq>
</Where>
OR
<Today OffsetDays='-45' />Date Overlaps
The following example queries for cases where a recurring event overlaps with the current date and time.
<Where>
<DateRangesOverlap>
<FieldRef Name="EventDate" />
<FieldRef Name="EndDate" />
<FieldRef Name="RecurrenceID" />
<Value Type="DateTime">
<Now />
</Value>
</DateRangesOverlap>
</Where>
Lookup ID, Lookup value
<Query>
<Where>
<Eq>
<FieldRef Name="State" LookupId="TRUE" />
<Value Type="Lookup">68</Value>
</Eq>
</Where>
</Query>
Multiple OR condition
<Query>
<Where>
<And>
<Geq><FieldRef Name='TaskDate' /><Value Type='DateTime'>2014-09-24T00:00:00Z</Value></Geq>
<In><FieldRef Name='Author' />
<Values>
<Value Type='Integer'>650</Value>
<Value Type='Integer'>108</Value>
<Value Type='Integer'>1534</Value>
</Values>
</In>
</And>
</Where>
</Query>
View Fields Fetch only mandatory columns
<QueryOptions>
many more to come...
<Query>
<Where>
<And>
<Geq><FieldRef Name='TaskDate' /><Value Type='DateTime'>2014-09-24T00:00:00Z</Value></Geq>
<In><FieldRef Name='Author' />
<Values>
<Value Type='Integer'>650</Value>
<Value Type='Integer'>108</Value>
<Value Type='Integer'>1534</Value>
</Values>
</In>
</And>
</Where>
</Query>
View Fields Fetch only mandatory columns
<QueryOptions>
<IncludeMandotoryFields="true" />
</QueryOptions>
many more to come...
No comments:
Post a Comment