Reputation: 540
In EpiServer, If an item is not being "used" or placed inside a contentarea, EpiServer marks the item as "The item is not in use", like this:
I have a contentarea where one can point out a media folder and it will list all files under that root, like this:
private IEnumerable<MediaData> GetMediaDataFilesFromRoot(ContentReference folder)
{
if (folder == null)
{
return new List<MediaData>();
}
return contentLoader.GetDescendantsOfType<MediaData>(folder);
}
. The problem is that when listing files from a root instead of "dragging and dropping" them onto the contentarea itself, is that EpiServer will not detect the files as "being in use". However, when I drop a file directly to the contentarea it gets marked as in use. Is it possible to modify this setting programmatically so all of the children files of my desired root will get marked as "in use" as well?
Upvotes: 0
Views: 46
Reputation: 7391
I'm not aware of an easy way of accomplishing that.
EPiServer keeps track of content being referenced by checking if it's:
Strictly speaking, the images beneath that folder aren't "in use" by EPiServer.
If it would consider the images as being in use, EPiServer would also warn editors when they try to delete an image in that folder. Although that may or may not be the behavior you want, it's not how EPiServer intended it. :/
Upvotes: 1