Create Event as Draft (Fluent API)

Posted by Community Admin on 04-Aug-2018 13:14

Create Event as Draft (Fluent API)

All Replies

Posted by Community Admin on 11-Dec-2012 00:00

Can someone please show me a simple example of creating an event directly to a draft version? I'd like for the yellow/orange icon to show up but I cannot figure this on out. Here's what I'm working with:

guid eventId = Guid.NewGuid();
                App.WorkWith().Event().CreateNew(eventId)
                    .Do(e =>
                    
                        //Set the event properties
                        e.Title = rssTitle;
                        e.Content = rssDescription;
                        e.ContactName = rssContactName;
                        e.ContactEmail = rssContactInfo;
                        e.ContactWeb = rssAddInfoURL;
                        e.EventStart = DateTime.Parse(rssEventStartDate.Trim(new[]  '"' )).AddHours(1);
                        if (equal)
                            e.EventEnd = DateTime.Parse(rssEventStartDate.Trim(new[]  '"' )).AddHours(2);
                        else
                            e.EventEnd = DateTime.Parse(rssEventEndDate.Trim(new[]  '"' )).AddHours(1);

                        e.PublicationDate = DateTime.Today;
                        e.ExpirationDate = DateTime.Today.AddDays(365);
                    )
                    .SaveChanges();

Posted by Community Admin on 14-Dec-2012 00:00

Hi Mart,

First you need to use a workflow in order to have the orange icon indicating that the workflow status of the item is "Awaiting approval" - see our Documentation for more information. Then just set this status from code like so:

e.ApprovalWorkflowState = "AwaitingApproval";

I hope this helps.

Greetings,
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