Can anyone point me towards some EPiServer subscription functionality documentation from a developers point of view as there is very lttle material out there. There seems to be high-level material only on the EPiServer website.
I have consulted the SDK but without examples its difficult pin down what I can make use of.
I have a scenario where we need subscription to work with properties on pages. So each page (in edit mode) can have properties set like "Region", "Work sector",..etc. A user can register to be notifed about a work sector in a specific region. The EPISubscribe property isnt really enough for this.
So if I register to be notified about agriculture in the north west of england, any changes to those pages that match this, based on what is set in edit mode, should be picked up/flagged for me (the subscriber).
Any help would be greatly appreciated.
I would love to see EPiServer document things like this better in the SDK/Developer's guide, but it seems Reflector will still be an important tool for years to come ;)
What you want to do is to create a custom subscription class that inherits from the EPiServer.Personalization.SubscriptionMail class. Then you need to override the "Send" method (you should really use Reflector to get an idea of what it looks like).
In the send method, can then filter the ChangedPages-collection (that is received as an argument to the method) on whatever properties you want (ie. Region, Sector). I recommend you store information about what Region/Sector a user is associated with or wants to subscribe to in the user's EPiServerProfile, because the UserData-property of your inherited class will contain the user's profile.
Then you configure EPiServer to use your class for subscriptions (can be done both from admin mode and in the site-element in web.config if I recall correctly) and you're done.
Hope this will help you on your way, but please ask if you want me to elaborate on anything :)
Thats fantastic. Thank you for the prompt reply and advice Jørgen. I'll give this a shot.
I am having trouble saving information about the region/sector to the users EPiServerProfile. I noticed there is a 'PropertyValues' property on the EPiServerProfile object but I am unable to create properties to add to it. Any pointers on how to do this?
If you are using the standard setup with the aspnet profile provider, you need to configure any properties you want to save to the profile. Look at the profile section in web.config.
Hi Magnus, that worked great, thank you