Sign up ×

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

1 Answer 1

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


