Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 7589

SPAlert.Filter not working

$
0
0

Can anybody help with SPAlert filters on Sharepoint 2013?

If I set Filter property on SPAlert instance  the alert has not been sent.

SPAlert newAlert = user.Alerts.Add(); SPAlertTemplateCollection alertTemplates = new SPAlertTemplateCollection( (SPWebService)(SPContext.Current.Site.WebApplication.Parent)); newAlert.AlertType = SPAlertType.List; newAlert.List = list; newAlert.Title = alertTitle; newAlert.DeliveryChannels = SPAlertDeliveryChannels.Email; newAlert.EventType = eventType; newAlert.AlertFrequency = SPAlertFrequency.Immediate; newAlert.AlertTemplate = alertTemplates[Constants.AlertTemplates.GenericListCustom];

var wsm = new WorkflowServicesManager(web); var wss = wsm.GetWorkflowSubscriptionService(); var subscriptions = wss.EnumerateSubscriptionsByList(list.ID); bool assotiationExist = false; var guid = Constants.Workflows.ApprovalWF.Guid; foreach (var subs in subscriptions) { assotiationExist = subs.DefinitionId == guid; if (assotiationExist) { newAlert.Filter = "<Query><Eq><FieldRef Name=\"ApprovalStatus\"/><Value type=\"string\">Approved</Value></Eq></Query>"; } } newAlert.Update(false);






Viewing all articles
Browse latest Browse all 7589

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>