Skip to main content
Blogging about SharePoint

Blogging about SharePoint

Search
Home
Blogging about SharePoint
Public Speaking
  
Michael Blumenthal's BlumenthalIT.NET > Blogging about SharePoint > Posts > Which views can be used when Creating an Alert ?  

December 27
Which views can be used when Creating an Alert ?

When you create an alert on a list, you have the option of specifying a view which limits which items would trigger the alert.

image

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>/

image

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.

image

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:

  1. The view cannot have its Hidden property true.  Checked within the 56A section.
  2. 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.
  3. The view must have a where clause.  This is checked in the 5F7 section.  Let's look at GetFilter more closely.

image

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. 

image

This is a thin wrapper around ParentWeb.Request.ValidateSubscriptionFilter.

image

Uh oh, it looks like we are getting into unmanaged (non-.NET) code.  Sure enough, this is where we hit the wall:

image

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.

--Michael

Comments

nice digging

Michael,
Great sleuthing skills. Thanks for sharing the techniques and the results. Who knew? A shame this isn't in the official dogs.
Tom
----------------
Tom Resing
Tom Resing's SharePoint Blog
Http://blogs.Microlinkllc.com/tresing
 on 12/28/2008 11:29 AM

Hmm...

We found that if we created a view based off an existing view it would not show up.  If we created it new of off a standard view template, it would show up in the list of views to select from for alert.

Interesting, but not sure why this is the case when the original view we cloned does show up in the drop down...
 on 5/21/2009 11:59 AM

Personal views can

Yes personal views can be used.

No all though, but that must be influenced by the same rules as the other ones (that we don't know at full).
 on 8/25/2009 3:25 AM

Nice! Wish I found this earlier!

Thanks for the post.  This helped me resolve an issue I was having with a programmatically created view not showing up in the New Alerts View drop down list.

Here's what happened to me:
       
The SPAlert object is the key to creating alerts programmatically.
http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.spalert_members.aspx

Note that SPAlert has a .Filter property that can be used to set the CAML for which items generate the alert.  I'm guessing this is what is used to set the alert to work with a view.

     I recently had an issue where I was programmatically adding views to a list and the views wouldn't show up in the New Alert page ([Your web]/_layouts/SubNew.aspx?List=[GUID of list]).  Where it says, "Send Alerts for these Changes" and "Someone changes an item that appears in the following view," the item wouldn't show up in the drop down list.

This blog entry actually has the closest clue to resolving this.

The view.Query had a FieldRef as below:

<Where>

<Eq><FieldRef Name="FieldName" /><Value Type="Choice">Some Choice Value</Value></Eq>

</Where>

I found a work around was to modify the view and save it using the GUI.  The view would then show up in the drop down list.

Further investigation showed that the GUI changed the query, as follows:

<Where>

<Eq><FieldRef Name="FieldName" /><Value Type="Text">Some Choice Value</Value></Eq>

</Where>



Changing the Value Type from "Choice" to "Text" fixed my issue!  I guess you can only have certain Value Types in the FieldRef section of your CAML.


 on 1/30/2011 8:34 PM

Lauren

 on 3/23/2012 1:57 AM

lester

industry, that will lead you to a brand new type of advertising and marketing to preserve your small business robust. But let us say the center of one's organization continues to be targeted on print catalogs that had been geared particularly in direction of the marketplace you had been utilised to concentrating on, and now you are confronted using the will need to concentrate on other folks. http://www.backshoes.net/sandals.html  http://www.backshoes.net/tall-boots.html  http://www.backshoes.net  .  What precisely do you do?   .  If you are conscious of this ZENITH Watches challenge, than you have currently handed the very first check. Several corporations are not conscious, or pick to not comprehend http://www.backshoes.net/sandals.html  http://www.backshoes.net/classic-collection.html , the truth that exactly the same type of catalogs will not usually function when handed into a totally various sort of client   . . Understanding the issue is not exactly the same as correcting it, http://www.backshoes.net/flats.html .  so let us go more than some choices for you personally. The initial is always to alter your current catalogs to superior
 on 6/1/2012 6:49 PM

burgundy wedding dresses

product range 8211 http://www.quedress.net/celebrity-dress-function-occasion.html ; http://www.quedress.net/evening-dress-function-occasion.html  digital, analog, chronograph   . , leather, stainless steel and titanium. It really does not matter which model you choose, there is a long term effect on your personality. Some models, http://www.quedress.net/ .  especially Festina down the top of the market and almost turned into a trademark monopoly market monitoring http://www.quedress.net/wedding-dress-function-occasion.html    . . Some models are much loved by sports enthusiasts and from time to time, the company has developed innovative features to enhance them further. Tour de France hits the alarm, after rolling on the market, fueled by competition and forced other watch producer based level. The brand has received rave reviews from the competition as well. scheme has received a boost at the start of a modified version of the brand to life by presenting it as Festina Tour de France Alarm Chronograph. Over the last 15 20 years, http://www.quedress.net/celebrity-dress-function-occasion.html  Festina watches have a type section for yourself tapping the pulse generated lover watch http://www.quedress.net/cocktail-dress-function-occasion.html . .
 on 6/14/2012 7:34 PM

tory burch flat

Length Mother DressRemember you can’t wear a heavy mother of the bride gown if it’s going to be an outdoor wedding on a day where it could potentially get up to 100+ degrees. http://www.war-shoes.com/autumn-collection.html  http://www.war-shoes.com/autumn-collection.html  You may want to look at tea length mother of the bride dresses as they allow you to stay fairly cool http://www.war-shoes.com/tall-boots.html , comfortable yet looking your best http://www.war-shoes.com/ . .cheap cheap long dresses online Chiffon Appliqued Short Sleeves With Beads Square Neckline Rouched Bodice Zip Back Column Shape Full Length Mother Dress MT 0072An on-line search will give you a long list of options, from architect and habit made fashions to ready to wear fashions in a range of sizes. The styles range from the young trendy type styles   .    .  http://www.war-shoes.com/tall-boots.html , to the more sophisticated, graceful ones, http://www.war-shoes.com/short-boots.html .  in wide varieties of fabrics and colors. With so a heap of buying goods choices available, it may be simple to find the perfectible modest mother of the bride dress for your special occasion.Have you been wanting to select that will hot prom dress with the special night. Do you need to make a sexy effect on your prom night. With so many
 on 6/21/2012 11:39 PM

christian louboutins

Honor" with the date for your wedding built in and mail them to the future bridal party, in addition to a wonderful notice or even unit card.You could have individualized non moving created at a number of websites that would match with your wedding ceremony and also engagement shower theme http://www.war-shoes.com/flats.html . http://www.war-shoes.com/tall-boots.html .    . While these are typically all excellent tips pertaining to inquiring your own ordinary to share with you your personal evening along with you, it's up to you to consider in order to inquire further collectively as well as separate.A number of ladies would rather ask their particular best friend initially and then their particular other ordinary secondly http://www.war-shoes.com/short-boots.html    .  http://www.war-shoes.com/ . .This gives the best friend to be able to decrease your current invitation nevertheless supply you with time with an aftermarket with no doing your current additional bridal party feel as if subsequent go with when you have to consult one to be your  http://www.war-shoes.com/tall-boots.html  http://www.war-shoes.com/sales-promotion.html 
 on 6/22/2012 1:07 AM

tory burch shoes

evening extra high rings plus metallics to liven some misconception.Cocktail: That dress program code means being an probability to get dressed in place in a manner that is actually hot and classy.Barbara Bradshaw and associates donned "cocktail" clothes every time they consumed their Cosmo's.. http://www.war-shoes.com/ . .You may invest in a dress wear (LBD), or a classy fitted skirts as well as sleeveless shirt, although the must-have accent can be a mindblowing list of strappy high heel sandals.Dressy: Just a little hide for certain, "dressy" is one area that you will find meant for most marriages, http://www.war-shoes.com/autumn-collection.html  vacation get-togethers as well as to dining in the great eating place http://www.war-shoes.com/sales-promotion.html .A pair of dress shorts coupled with an elegant shirt or even a very simple however complex apparel will be delaware riguer.   .    . Computer system courses once while sporting nylons along  http://www.war-shoes.com/sales-promotion.html  http://www.war-shoes.com/sales-promotion.html .  http://www.war-shoes.com/classic-collection.html 
 on 6/22/2012 2:12 AM
1 - 10Next

Add Comment

Items on this list require content approval. Your submission will not appear in public views until approved by someone with proper rights. More information on content approval.

Title


Body *


Please put your name at the end of your comment as the Name field doesn't display in the main view of the comments.

Name: *


Your name.  If you first name is Michael, please provide initials or the like to clearly distinguish your name from Michael Blumenthal's.
Also, this field does not appear in the main view of the comments.

Need Paid Consulting Services?

Are you interested in engaging a SharePoint consultant for fee-based consulting services?  If so, I can have an Account Executive from my employer contact you.  Other site visitors will not see this column.

Additional Contact Information

Please provide additional contact information if you need a direct response.  Other site visitors will not see this column.

What is tomorrow's date? *

Select a date from the calendar.
This is a weak CAPTCHA based on advice from a tweet from @ToddKlindt.

Attachments