More in this section

Forums / Developing with Sitefinity / Query Images Excluding Recycle Bin

Query Images Excluding Recycle Bin

2 posts, 0 answered
  1. Stacey
    Stacey avatar
    291 posts
    18 Oct 2012
    05 Jun 2015
    Link to this post

    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);




  2. Kaloyan
    Kaloyan avatar
    272 posts
    06 Feb 2017
    10 Jun 2015
    Link to this post
    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

    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
2 posts, 0 answered