Hi,
I have a list of UsedVisitorGroups, I used the code from david-tecs Visitor Group Usage Viewer https://www.david-tec.com/2015/05/visitor-group-usage-viewer-for-episerver-8/
And a list of pages that uses Visitor groups:
var personalisedPages = new List<ContentReference>();
foreach (var pageRef in contentLoader.GetDescendents(ContentReference.StartPage))
{
var page = contentLoader.Get<PageData>(pageRef);
var isPersonalised = page.Property.Any(p => ((p as IPersonalizedRoles)?.GetRoles().Any() ?? false) ||
(((p as PropertyContentArea)?.Value as ContentArea)?.Items?.Any(x => !string.IsNullOrEmpty(x.ContentGroup)) ?? false));
if (isPersonalised)
{
personalisedPages.Add(pageRef);
}
}
I'm trying to match page with visitor group, to be able to filter pages for a specific group.
So the outcome will be something like this https://world.episerver.com/globalassets/globals/xmlrpc/21272/2011/08/18/image_2.png
Suggestions?
Any help very much appreciated!