Published/Draft Issue when programatically creating event
I'm updating my 3.7 code for custom event creation to 4.x and I'm seeing an odd issue with the events I'm creating:
I finally have it to where my event is entered and it will show up in an event control. However when you view it in the admin, it shows with a green check but says draft under the title of the event. Am I missing at step and leaving my events in a "pseudo" published state?
EventsManager eManager =
new
EventsManager();
Event newEvent = eManager.CreateEvent();
newEvent.Title = Title.Text;
newEvent.Content = EventContent.Text;
newEvent.UrlName = Title.Text.Replace(
" "
,
"-"
);
eManager.Publish(newEvent);
eManager.SaveChanges();
I figured it out. In addition to publishing it, I'm now setting the ApprovalWorkFlowState to "Published", my events are now showing Green check & Published in the admin.