1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Fluent api returning Events in draft status?

Fluent api returning Events in draft status?

2 posts, 0 answered
  1. Jimmy
    Jimmy avatar
    7 posts
    Registered:
    23 Apr 2012
    10 Jan 2013
    Link to this post
    eventList= App.WorkWith()
    .Events().Where(ev => ev.Status == ContentLifecycleStatus.Live && ev.Visible == true)
        .Publihed().Get().ToList();





    How to filter events in Draft status?   Is there a .NotDrafts() option in Fluent api?
  2. Pavel Benov
    Pavel Benov avatar
    341 posts
    Registered:
    14 Mar 2016
    15 Jan 2013
    Link to this post
    Hello Jimmy,

    Thank you for contacting us.

    There is no NotDraft() or similar way to filter our the events in draft status. However when using Published() should get only the items that are published and scheduled for publishing. This is the filter implementation we have in the Published() method:

    return (item) => item.Visible == true &&
    item.Status == ContentLifecycleStatus.Live &&
    item.PublicationDate <= DateTime.UtcNow &&
    (item.ExpirationDate == null || item.ExpirationDate > DateTime.UtcNow);

    Based on that calling it the following way:
    var eventList = App.WorkWith()
                    .Events().Published().Get().ToList();

    should be sufficient to filter out the drafts.

    Please try this out on your end and let me know if it worked. Looking forward to your response.

    Regards,
    Pavel Benov
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
2 posts, 0 answered