Hi,
When a user want to subscribe to our newsletter, I want to the user to subscribe to every section automatically.
I've manage to do this, but the performance is too slow because we have a lot of pages in EPiServer.
Is there perhaps a better way of achieving the same functionality? e.g. somehow using the SubscriptionList
Please see my code below:
// subscribe to all
PageDataCollection colPages = new PageDataCollection();
PropertyCriteriaCollection col = new PropertyCriteriaCollection();
PropertyCriteria crForm = new PropertyCriteria();
crForm.Type = PropertyDataType.Boolean;
crForm.Condition = CompareCondition.Equal;
crForm.Name = "EPSUBSCRIBE";
crForm.Value = "true";
col.Add(crForm);
colPages = Global.EPDataFactory.FindPagesWithCriteria(EPiServer.Global.EPConfig.StartPage,col); // searching through the entire site!!
SubscriptionInfo info = new SubscriptionInfo(savedUser);
for (int i=0; i < colPages.Count; i++)
{
info.SubscribeTo(colPages[i].PageLink);
}
Thanks,
Danie
// subscribe to all PageDataCollection colPages = new PageDataCollection(); PropertyCriteriaCollection col = new PropertyCriteriaCollection(); PropertyCriteria crForm = new PropertyCriteria(); crForm.Type = PropertyDataType.Boolean; crForm.Condition = CompareCondition.Equal; crForm.Name = "EPSUBSCRIBE"; crForm.Value = "true"; col.Add(crForm); colPages = Global.EPDataFactory.FindPagesWithCriteria(EPiServer.Global.EPConfig.StartPage,col); // searching through the entire site!! SubscriptionInfo info = new SubscriptionInfo(savedUser); for (int i=0; i < colPages.Count; i++) { info.SubscribeTo(colPages[i].PageLink); }
Thanks, Danie