Newly Created Content Items Appear as Draft
I'm creating event content items using the following code:
App.WorkWith().Event().CreateNew().Do(calEvent =>
eventID = calEvent.Id;
PopulateNewEvent(calEvent, currentUser);
)
.Publish()
.SaveChanges();
Hello Geoff,
Try using this way
Guid eventId = Guid.Empty;
var title =
"TestEvent"
;
var TestContent =
"TestContent"
;
App.WorkWith().Event().CreateNew().Do(ev =>
eventId = ev.Id;
ev.Title = title;
ev.Visible =
true
;
ev.Content = TestContent;
ev.DateCreated = DateTime.Now;
ev.ApprovalWorkflowState =
"Published"
;
)
.SaveChanges();
Seems counterintuitive, but that appears to have corrected the issue. Thank you, Ivan.
I'm curious, what does the .Publish() method do exactly?
Thanks.
Hello Geoff,
It calls Publish method of the EventsManager which publishes the master state and creates a new version of the item, but this does not update the workflow state that is shown on the label.
Greetings,
Ivan Dimitrov
the Telerik team