Create Event as Draft (Fluent API)
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();
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"
;