November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
I would loop through the user profiles and add use a Dictionary<int, List<string>> to store a list of subscribers for each page ID that occurs. This will of course miss pages with no subscribers. And if you have subscribers for different languages you'd have to use something else as a key.
But this is basically what you did if I understand correctly. Why isn't it working?
That could be a nice little blogpost or release on epis codesharing or epicode.
Ok I admit it. I'm lazy and would like have to do it myself :)
@Magnus: Thanks - yes, this is what I did, and it works fine. It is the reverse of the problem that I'm trying to answer.
Looping through profiles and getting the pages they have subscribed to is okay.
BUT looping through and determining PAGES that HAVE subscribers is where I'm hoping for a pointer.
@Per: I believe it would be something that will be suitable to codesharing. And, when complete I will be happy to. I'm quite new to this whole technology - would you be prepared to look over my result and mentor me through the process? Nothing too arduous.
Here's a screen shot of the intention. Emails have been removed, because I'm caring.
I think I'm missing the point here. What I suggested would be sed to list the subscribers for each page (and not the subscriptions for each user) even though I'm finding the information by looping through the users. Like this:
var map = new Dictionary<int, List<string>>();
foreach (ProfileInfo profile in ProfileManager.GetAllProfiles(ProfileAuthenticationOption.All))
{
var epiProfile = EPiServerProfile.Get(profile.UserName);
if ((epiProfile != null) && (epiProfile.SubscriptionInfo != null))
{
foreach (var pageLink in epiProfile.SubscriptionInfo.ListSubscriptions())
{
List<string> subscribers;
if (!map.TryGetValue(pageLink.ID, out subscribers))
{
subscribers = new List<string>();
map.Add(pageLink.ID, subscribers);
}
subscribers.Add(epiProfile.UserName);
}
}
}// map now contains all page IDs with subscribers and a list of subscribers for each page
Or is there a reason why you want to collect this information by looping through the pages rather than the profiles?
Thank you Magnus. I was missing your point. Fairly new to this environment and my mind-set was on having to troll pages. I will look to making this report available through epicode.
just remember that the SubscriptionDescriptor Languages property with all the users subscribed languages for that page. Magnus code should work for single language sites thou
Im using Episerver 6 R2 and I cant see how I would add a user to a subscription list and set up pages to subscribe to. I have seen a blog talking about EPSUBSCRIBE but I have no idea what this is and where to set it to TRUE.
Do you know of any step by step guides regarding Subscriptions using the CMS?
Thanks
Jonathan
Jonathan,
As I understand it EPSUBSCRIBE (and its counterpart EPSUBSCRIBE-EXCLUDE) are effectively built-in EPiServer properties. To make a page subscribable the page's PAGETYPE should have the EPSUBSCRIBE property included in it - this can be added in Admin mode. It must be named correctly, and is of type "Selected/Unselected". Checking this property on a published page allows it to be found and managed by your subscription processes - both your front end pages and logic that will allow a user to subscribe, and the backend scheduled process that undertakes to fulfil subscriptions. A good starting place for the front end subscription process is using the Alloy Tech example pages/code. The back end schedule works automagically.
I am writing a report for subscriptions to pages on our site. Initially the report will present two views:
Number 1 has been completed reasonably simply - looping through all profiles using ProfileManager, and then gathering each profiles SubscriptionInfo.SubscribedPages.
Doing similarly for number 2 is reaching road blocks: even considering the way that the subscriptionJob determines which pages have subscribers has not helped.
How do I get a listing of pages which have subscribers, and then derive who is subscribed to each page?
So, along the lines of this which works by profile: foreach (SubscriptionDescriptor sd in profile.SubscriptionInfo.SubscribedPages)
something like this for pages: foreach(EpiServerProfile pr in pageref.HasSubscribers.Subscriber.UserName)
Thanks in anticipation