Query Images Excluding Recycle Bin
What is the official recommended way to do this? The following code below generates an exception.
Exception for code below:
Identifier 'IsDeleted' is not a parameter or variable or field of 'Telerik.Sitefinity.Libraries.Model.Image'. If 'IsDeleted' is a property please add the FieldAlias or Storage attribute to it or declare it as a field's alias.
model.Images = App.WorkWith().Images().Get().Where(i => i.Parent.Title == Library
&& i.Status == ContentLifecycleStatus.Live
&& i.IsDeleted ==
false
);
I tried using "IsDeleted" with the via the native query approach with the same exception. The following code works.
album.Images().Where(i => i.Status == ContentLifecycleStatus.Live && i.Visible ==
true
);
Hello Stacey,
You have to filter by Visible property in order to get only published items. Please check the following forum thread where this is explained in details.
Get Published Items Only
Regards,
Kaloyan
Telerik