lunedì, gennaio 25, 2010

SharePoint Designer and Date Calculations

I was struggling to accomplish a simple date calculation that would be simple in a SharePoint List view. [Today]-15 and [Today]+15. Thanks to the Microsoft SharePoint Designer Team Blog I now know it is also a simple CAML manipulation. The key word to search for is “Offset!” Here is the excerpt from the SPDT Blog:

<SharePoint:SPDataSource

...

selectcommand="<View><Query>

<OrderBy><FieldRef Name='Date_Due' Ascending='TRUE'/></OrderBy>

<Where><Leq><FieldRef Name='Date_Due'/><Value Type='DateTime'><Today OffsetDays='+15'/></Value>

</Leq></Where></Query></View>"

...

>