Skip to main content

SharePoint Alerts: The default 9 "Send Alerts for These Changes " Task List Alerts

Hello folks.

Once upon a time, I was trying to create SharePoint Task list Alerts programmatically for each user that had been granted permissions to the specific site. The requirement was that these users would be assigned tasks and they needed to receive notifications summarising all the tasks that they had been assigned, on a daily basis.
Thanks to our old man Mr SharePoint, who has Alerts that can help us achieve this need. The major work for me to achieve this was setting up the "Send Alerts for These Changes" filter, which required building a CAML query. I finally came right but then I thought about documenting the CAML queries for each one of these filters,, with the correct syntax, which by default out-of-the-box are 9, and am sure would save someone sometime.

So here is a list of the default 9 "Send Alerts for These Changes " Task List Alerts.

1. Anything changes
alert.Filter = "";
2. A task is assigned to me
alert.Filter = "<Query><And><Eq><Value type="string">" + user.LoginName + "</Value><FieldRef Name="AssignedTo/New"/></Eq><Neq><Value type="string">" + user.LoginName + "</Value><FieldRef Name="AssignedTo/Old"/></Neq></And></Query>";
3. A task becomes complete
alert.Filter = "<Query><And><Eq><Value type="string">completed</Value><FieldRef Name="Status/New"/></Eq><Neq><Value type="string">completed</Value><FieldRef Name="Status/Old"/></Neq></And></Query>";
4. A high priority task changes
alert.Filter = "<Query><Or><Eq><Value type="string">" + PriotityChoiceString + "</Value><FieldRef Name="Priority/New"/></Eq><Eq><Value type="string">" + PriotityChoiceString + "</Value><FieldRef Name="Priority/Old"/></Eq></Or></Query>";
5. Someone else changes a task assigned to me
alert.Filter = "<Query><And><Or><Eq><Value type="string">" + user.LoginName + "</Value><FieldRef Name="AssignedTo/New"/></Eq><Eq><Value type="string">" + user.LoginName + "</Value><FieldRef Name="AssignedTo/Old"/></Eq></Or><Neq><Value type="string">" + user.LoginName + "</Value><FieldRef Name="Editor/New"/></Neq></And></Query>";
6. Someone else changes a task

alert.Filter = "<Query><Neq><Value type="string">" + user.LoginName + "</Value><FieldRef Name="Editor/New"/></Neq></Query>";
7. Someone else changes a task created by me

alert.Filter = "<Query><And><Or><Eq><Value type="string">" + user.LoginName + "</Value><FieldRef Name="Author/New"/></Eq><Eq><Value type="string">" + user.LoginName + "</Value><FieldRef Name="Author/Old"/></Eq></Or><Neq><Value type="string">" + user.LoginName + "</Value><FieldRef Name="Editor/New"/></Neq></And></Query>";
8. Someone else changes a task last modified by me

alert.Filter = "<Query><And><Eq><Value type="string">" + user.LoginName + "</Value><FieldRef Name="Editor/Old"/></Eq><Neq><Value type="string">" + user.LoginName + "</Value><FieldRef Name="Editor/New"/></Neq></And></Query>";
9. Someone changes an item that appears in the following view
alert.Filter = "<Query><Eq><FieldRef Name="AssignedTo"/><Value type="string">" + user.LoginName + "</Value></Eq></Query>";

Enjoy!

Comments

Popular posts from this blog

Zambia's first K2 BlackPoint roll-out

Reporting to you live from Code|Influence... My colleague and I have been managing our organization's SharePoint infrastructure for some time now and we have just rolled out the first K2 BlackPoint in the country, intended mostly for SharePoint workflow developments.

How to document your SharePoint Projects.

Here are the essential documents you need to complete… Initiation Business Case: To justify the financial investment in your SharePoint Project, you need to write a Business Case. It lists the costs and benefits, so everyone knows what the return on investment will be. Feasibility Study: Before you kick-off your SharePoint Project, you need to determine whether your project is feasible, using a Feasibility Study. SharePoint Project Charter: You then need to document the objectives, scope, team, timeframes and deliverables in a SharePoint Project Charter. Planning SharePoint Project Plan: You need to create a Project Plan listing all of the tasks required to undertake your SharePoint Project from start to finish. Every task must be scheduled, so you know what needs to be done and when. Resource Plan: Next, you need to plan your resources by documenting the money, equipment and materials needed for your SharePoint Project. Quality Plan: You then need to set quality targets, so that the S...

Zambia's first Copper Concentrate Logistics System on SharePoint 2007

Ok so my workmate Charles and I just finished developing a Copper Concentrate Logistics System on SharePoint 2007. Again we do something that has never been done before in Zambia, on SharePoint!!! So here is how it works: First of all, it’s mainly using SharePoint Lists, Views dependent on your log in credentials, InfoPath Forms that pull their data from the SharePoint list based on specific selection criteria. The marketing dept captures the details of the trucks expected to arrive, only after which, the Security personnel will be able to see the details of the expected trucks and authorize entry. This then allows the truck details on empty weight and on loaded weight to be captured to the same system from the Weighbridge and sealing details confirmed. Only when the weighbridge process has been confirmed, the Security to authorize exit would be able to view the truck details, which they will use for their exit authorization. This piece of a SharePoint system generates various reports...