In SharePoint when we overwrite Alert emails. We have to also register our Alert Template file, which is deployed to SharePoint hive.
Usually, we are provided with "stsadm" commands to register this alert template file.
But we can also do it with c#.
Write a feature which is "Site" Scope
var AlertTemplateFile = SPUtility.GetCurrentGenericSetupPath(@"TEMPLATE\XML\YourFolder\YourAlertTemplates.xml");
SPSite oSPSite = properties.Feature.Parent as SPSite;
SPWebApplication oSPWebApplication = SPWebApplication.Lookup(new Uri(oSPSite.Url));
SPWebService oSPWebService = (SPWebService)oSPWebApplication.Parent;
new SPAlertTemplateCollection(oSPWebService).InitAlertTemplatesFromFile( AlertTemplateFile );
No comments:
Post a Comment