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

Forums / Developing with Sitefinity / Create Event as Draft (Fluent API)

Create Event as Draft (Fluent API)

2 posts, 0 answered
  1. Mark
    Mark avatar
    2 posts
    Registered:
    22 Apr 2011
    11 Dec 2012
    Link to this post
    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();
  2. Pavel Benov
    Pavel Benov avatar
    341 posts
    Registered:
    14 Mar 2016
    14 Dec 2012
    Link to this post
    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
2 posts, 0 answered