Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

The quick version (SP2010 Enterprise): What requirements/limitations are there for being able to assign a view to an alert?

The full explanation:

I've been playing around with creating alerts via C# and have come to a point where I want to make alerts based on a view. I've found some good resources for what code to use to do this (basically adding properties to the SPAlert that specify the view), but the problem I'm running into is that it seems there are lots of restrictions on when/where/what views can be used in an alert.

I have a dev server set up where I've been doing the experiments, but results are not consistent with what happens on the production server (single-server 2010 Enterprise farm with a separate SQL server, VS2012). On the dev server, when creating an alert through the GUI, only specific views show up as options. After researching this I found a few people saying it has to do with what is in the view's filter, but the view I wanted still showed up so I wasn't too concerned with that.

However, when I went to try the same thing on the production server (GUI-made alert using the desired view), NO views were available, resulting in that option being completely absent. Remembering what I had read about the view filter making a difference, I made a new view that was in every way identical to the one on the dev server, and tried again. No love.

Further research revealed it may have to do with the type of library... There were faint rumors that it could only be done on a document library. So I tried the exact same procedure on a document library (on production server, made the view, then tried to make an alert through the GUI), but the option was STILL not available.

At this point, the inconsistencies are so confusing that I'm just stumped. Identical libraries with identical views on the dev server and production server... and yet they produce different results when trying to create an alert. I've taken several stabs in the dark: making personal views, default views, simplifying the filter, different libraries, etc. with no success. No matter what I do, the option is not available on the production server.

Before I even get to the coding part I need to make sure it can work at all. The desired target library is an asset library, and the desired view's filter shows only {Created By}=[Me] OR {Content Type}=folder OR when a custom column is set to flag the document as public.

Can anyone give me insights into the requirements for doing this?

Cheers!

share|improve this question

1 Answer 1

up vote 1 down vote accepted

Figured it out, the {Content Type}=folder was the issue. Took that part out and bam, it worked.

Also managed to get the code working to programmatically create alerts based on a view, if anyone is curious, these are the properties that must be added to the alert to do that:

oAlert.Properties["filterindex"] = "4";
oAlert.Properties["viewid"] = "899bc659-5952-46cc-be7b-a65a3724d701"; //This is the GUID of the view you want to use
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.