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

SharePoint: How to create a custom action to open Word Documents using "Edit in Microsoft Word".

Imagine you have a SharePoint custom search webpart, and on your search results, you return word documents, you will obviously want to at times be able to open them in your MS Word client program for editing. So basically, depending on your office client installed on your local machine, there are 2 different approaches that can be made for Office 2003 and Office 2007/10, using the same function " editDocumentWithProgID2 ". For Office 2003: - If your document libraries versioning settings have got "Require Check out" ticked, then you will first want to check out the document using: onclick ="CheckoutviaXmlhttp(‘{SiteURL}’, ‘{DocumentDownloadURL}’)" - Then to open the document, you use: onclick =" return editDocumentWithProgID2(‘ {DocumentDownloadURL} ’, ”, ‘SharePoint.OpenDocuments’, ’1′,’ {SiteURL} ’, ’0′);" href ="#" - and now combining the above 2 actions into one clickable action: onclick ="CheckoutviaXmlhttp(‘ {SiteURL} ’, ‘ {...

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 Scope your SharePoint Projects

The "SharePoint project scope" is all of the things that must be produced to complete a SharePoint project. These 'things' are called deliverables and you need to describe them in depth as early in the SharePoint project as possible, so everyone knows what needs to be produced. Take these 5 Steps to scope your SharePoint projects: Step 1: Set the Direction Start off by setting the direction for the SharePoint project. Do you have an agreed SharePoint project Vision, Objectives and Timeframes? Are they specified in depth and has your customer agreed to them? Does everyone in the SharePoint project team truly understand them and why they are important? Only by fixing the SharePoint project direction can you truly fix the SharePoint project scope. Step 2: Scope Workshops The best way to get buy-in to your SharePoint project scope is to get all of the relevant stakeholders to help you define it. So get your SharePoint project sponsor, customer and other stakeholders in a ...