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

Forums / Developing with Sitefinity / Published/Draft Issue when programatically creating event

Published/Draft Issue when programatically creating event

2 posts, 0 answered
  1. Jon Ingersoll
    Jon Ingersoll avatar
    32 posts
    Registered:
    12 May 2009
    12 May 2011
    Link to this post
    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();
  2. Jon Ingersoll
    Jon Ingersoll avatar
    32 posts
    Registered:
    12 May 2009
    12 May 2011
    Link to this post
    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.
2 posts, 0 answered