Try our conversational search powered by Generative AI!

FilterForVisitor, MediaData


Hey guys

I want to display ContentFolders and MediaData and filter it for the current user.

This line gives me the unfiltered content (which is of no use to me):

var folders = repository.GetChildren(folder.ContentLink).ToList(); // gives me 2 hits

but when I try to filter it, I get zero hits:

var filteredFolders = EPiServer.Filters.FilterForVisitor.Filter(foldersLevel1); // gives zero hits

Even when logged in as web admin I get zero hits. The access rights are correct.



Aug 28, 2015 14:35

Hello again,

I found out how to. The key was to use the FilterAccess class.

var fa = new FilterAccess();
var folders = repository.GetChildren<IContent>(folder.ContentLink)
   .Where(a => !fa.ShouldFilter(a))


Edited, Aug 31, 2015 14:04
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.