I started using AF Notification 2016 R@ with AF SDK 2.8.6.
I need to get notification rules that a specific user subscribed to them and also get active event frame related to those notification rules. In another words I want to have list of subscribed notification for a specific user and highlight the one that are active.
I tried following:
AFNotificationRuleSearch results = new AFNotificationRuleSearch(af_db, "MySearch", "ContactName:'[contact name]'");
What "ContactName" criteria is supposed to be? Is it contact name of notification's subscriber? It always returns all existing notification rules.
AFContact me = AFContact.FindContact(afRepository.PiSystem, "[contact name]'"); AFNotificationRuleSearch nrSearch = new AFNotificationRuleSearch(af_db, "MySearch", "Contact:'" + me.GetPath() + "'");
Based on documents the value for Contact criteria should be path to AFContact object. I get following error on this query:
The object for search criteria 'Contact:"\\[AF Server Name]\Contacts[contact name]"' was not found.
Also I tried to use AFEventFrameSearch:
AFEventFrameSearch efSearch = new AFEventFrameSearch(af_db, string.Empty, "InProgress:True");
It correctly rerun all in progress event frames. Filtering these event frames based on subscribers is so slow:
var efs = efSearch.FindEventFrames().Select(x => x.PrimaryReferencedElement.NotificationRules.Where(y => y.Subscribers.Any(z => z.Name.Contains("[contact name]")))).ToList();
Am I doing right thing?
Is it possible to get users's subscribed notification and also it they are active at the moment in a faster way?