by Oscar
27. August 2008 20:02
Was working on getting Tasks assigned to a user on a custom DataViewWebPart titled “My Critical Tasks”. It is easy to obtain past due items, but sometimes you need both Past Due and due in X number of days. I was battling (as with anything SharePoint) with this CAML query, but finally got this one to work.
On my XSL I render an indicator image based on the date each Task has, looks something like this (FIGURE 1). I enabled editing as well, so a user can edit the status of the task right from the home page and modify the Due Date, Status, and Notes if needed!
FIGURE 1 – Tasks shown based on the User that is currently logged onto the MOSS Site.
FIGURE 2 – Editing a Task on the WebPart
<Query>
<Where>
<And>
<And>
<And>
<Geq>
<FieldRef Name='DueDate' />
<Value Type='DateTime'>
<Today OffsetDays='-21' />
</Value>
</Geq>
<Eq>
<FieldRef Name='AssignedTo' />
<Value Type='Integer'><UserID/></Value>
</Eq>
</And>
<Neq><FieldRef Name='Status'/><Value Type='Text'>Completed</Value></Neq>
</And>
<Or>
<IsNotNull>
<FieldRef Name='Related_x0020_Event'/>
</IsNotNull>
<IsNotNull>
<FieldRef Name='Related_x0020_Course'/>
</IsNotNull>
</Or>
</And>
</Where>
<OrderBy>
<FieldRef Name='DueDate' Ascending='True' />
</OrderBy>
</Query>
by Oscar
13. August 2008 01:29
On my current project we had a requirement where based on the user browsing the SP Site, I needed to set the value of a MultiChoice Field to yes/no.
At first, I had difficult time figuring out why my code was not updating the value of my field. Here is what works! Specifically, the SystemUpdate(false) is what did it.
//always set the locked value to YES.
properties.AfterProperties["Locked_x0020_and_x0020_ready_x00"] = "Yes";
try
{
DisableEventFiring();
properties.ListItem.SystemUpdate(false);
EnableEventFiring();
}
catch (SPException ex) {}
Hope this helps you,
O