Published/Draft Issue when programatically creating event

Posted by Community Admin on 04-Aug-2018 17:00

Published/Draft Issue when programatically creating event

All Replies

Posted by Community Admin on 12-May-2011 00:00

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();

Posted by Community Admin on 12-May-2011 00:00

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.

This thread is closed