When you create an alert on a list, you have the option of specifying a view which limits which items would trigger the alert.
Note however that the list of views you can choose from is a subset of the views available on the list. In fact, if you don't have any views that are ok to use for alerts, you won't even see the option to select a view.
What are the rules that determine which views are available for use?
Experimentally, my guesses are:
1) It must have a where clause. All Items views don't show up in the list of views, and it's pointless to use an All Items view because it doesn't filter.
2) It must be a public view, it cannot be a personal view.
3) It cannot involve content approval.
To try to substantiate these guesses, I went to the source with .NET Reflector (http://www.red-gate.com/products/reflector/).
The page to create a new alert is _layouts/subnew.aspx.
Its code-behind is the SubNewPage in the Microsoft.SharePoint.ApplicationPages dll. This is in Inetpub\wwwrooot\wss\virtualDirectories\<dir for the web app>\app_bin.
You need to open it in Reflector. Some of the other SharePoint DLL's are in the GAC, so you may need to copy those DLL's out of the GAC into a more accessible place. To get a dll out of the GAC, use the command prompt to look around c:\windows\assembly rather than windows explorer. My copy of the Microsoft.SharePoint.dll and Microsoft.SharePoint.Library.dll was c:\windows\assembly\GAC_MSIL\<dll name without extension>/<version number>_<public key token>/
Once you have the ApplicationPages DLL open in Reflector, find the SubNewPage class. Note It inherits from SubNewEditBasePage, so we now look at that base class because SubNewPage doesn't do anything specific to the list of views.
Within SubNewEditBasePage, there is an InitForm method that walks through the views for the current list, and only adds to the drop down list the views it likes.
The code here is a little hard to understand due to the goto's, but some of the details we can pick out are a qualified view is added to the drop down list box in section 58B and that that in order for the view to be listed:
- The view cannot have its Hidden property true. Checked within the 56A section.
- The view must have a title - probably the nameless views used by certain list viewing web parts do not (a guess). Title is checked within the 57B section.
- The view must have a where clause. This is checked in the 5F7 section. Let's look at GetFilter more closely.
Here we can see that if v.Query is not null (which I interpret as "if there is a where clause") and the query does not use the DateRangesOverlap tag, then we can consider the view further, for possible inclusion in the drop down list.
The next thing it does of significance is to call ValidateFilter on the where clause XML.
This is a thin wrapper around ParentWeb.Request.ValidateSubscriptionFilter.
Uh oh, it looks like we are getting into unmanaged (non-.NET) code. Sure enough, this is where we hit the wall:
We can't look inside this with .NET Reflector, so this is the end of the line. If anyone else has information on what the rules are for which views can be used in alerts, please leave a comment.