Fluent api returning Events in draft status?

Posted by Community Admin on 04-Aug-2018 22:57

Fluent api returning Events in draft status?

All Replies

Posted by Community Admin on 10-Jan-2013 00:00

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?

Posted by Community Admin on 15-Jan-2013 00:00

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

This thread is closed