App.WorkWith().Albums().Images broken in 5.1?
From this link:
http://www.sitefinity.com/documentation/documentationarticles/developers-guide/sitefinity-essentials/modules/media-modules/images/managing-albums/querying-albums
Upgrading to 5.1 seems to have broken the ability to do App.WorkWith().Albums().Images
'Telerik.Sitefinity.Libraries.Model.Album' does not contain a definition for 'Images' and no extension method 'Images' accepting a first argument of type 'Telerik.Sitefinity.Libraries.Model.Album' could be found (are you missing a using directive or an assembly reference?)
Oops, let me clarify, it's done by this exact code.
Bumping.
how do i retreive images from an album by album name?
Hi, Chris.
In order to decrease the consumed memory and increase the overall performance of Sitefinity, several properties (in-memory collections) of given classes were replaced with extension methods that return the same data via IQueryable collections. See this page from the documentation.
One of these was the Album class. So Images is now an extension method of Album as shown here.
So your code needs to change just a bit:
public
static
List<Telerik.Sitefinity.Libraries.Model.Image> GetImagesByAlbumName(
string
albumName)
var album = App.WorkWith().Albums().Where(a => a.Title == albumName).Get().FirstOrDefault();
if
(album !=
null
)
return
album.Images().Where(x => x.Status == ContentLifecycleStatus.Live && x.Visible).OrderBy(x => x.Ordinal).ToList();
else
return
new
List<Telerik.Sitefinity.Libraries.Model.Image>();
using
Telerik.Sitefinity.Modules.Libraries;
Much appreciated, thanks for that link.