Selecting root level images of library
I have a library called Slides that contains 5 images. I then have a nested folder that contains 2 images. I am looking for the best way to display only the 5 images when a user selects the Slides library via my widget designer. Right now this is what I have that works, but I am guessing there is a better way.
if
(
this
.AlbumId != Guid.Empty)
model.AlbumId =
this
.AlbumId;
var manager = LibrariesManager.GetManager();
var album = manager.FindFolderById(model.AlbumId);
if
(album.GetType() ==
typeof
(Telerik.Sitefinity.Libraries.Model.Album))
model.Images = ((Telerik.Sitefinity.Libraries.Model.Album)album).Images().Where(i => i.FolderId ==
null
&& i.Status == ContentLifecycleStatus.Live);
else
model.Images = manager.GetImages().Where(i => i.FolderId == album.Id && i.Status == ContentLifecycleStatus.Live);
Hello Stacey,
The approach you took is the correct one, because the difference between the top level library and the nested folders (libraries) is only that the top level library doesn't have a folderId.
Regards,