SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I using following code to change AlertTemplate for a list. But it dosen't work. When I look at the XML for the template variable it's the correct XML. But when I look att list.AlertTemplate after that I have set the template object to it, it's XML is still unchanged. What should I do for to solve it?

                XmlDocument xmlDoc = new XmlDocument();
                xmlDoc.Load(SPUtility.GetGenericSetupPath(@"TEMPLATE\XML") + "\\SubscribeOrdersAlert.xml");
                    SPList list = site.RootWeb.GetList("/Lists/Tillggsbestllningar");
                    SPAlertTemplate template = new SPAlertTemplate();
                    template.Xml = xmlDoc.InnerXml;
                    template.Name = "Tilläggsbeställningar";
                    list.AlertTemplate = template;
                    list.ParentWeb.AllowUnsafeUpdates = true;
share|improve this question
I have found out that I needed to add the alert template to the SPAlertTemplateCollection. But when I do it I get "Access denied" sPAlertTemplateCollection.Add(template); – Daniel Jan 18 '12 at 11:41
up vote 0 down vote accepted

I deployed the xml with a stsadm-command and then it worked.

stsadm -o updatealerttemplates- url -filename c:\SubscribeOrdersAlert.xml
share|improve this answer

Your Answer


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.