Event Calendar Documentation
Sitefinity team -- the new event calendar is fantastic, fast and flexible...thank you!
I need to programatically create new event calendars, and then add events to them. I checked the documentation and didn't see anything on it yet. Can you please post some quick samples on working with them?
I've been trying to find what I need through Just Decompile and it looks like I need to set the parent of event event as a calendar. I had previously assigned a custom field "BusinessCategory" to handle filtering. I'm trying to loop through all of my events and add it to a corresponding calendar but sitefinity is running into a manager issue.
EventsManager manager = EventsManager.GetManager();IEnumerable<Event> events = App.WorkWith().Events().Where(ev => ev.Status == ContentLifecycleStatus.Master).Get().ToList();IList<Event> filteredEvents = new List<Event>();IEnumerable<Event> matchingEvents = events.Where(ev => ev.GetSafeCustomField<string>("BusinessCategory") != String.Empty).ToList(); foreach (Event thisEvent in matchingEvents) switch (thisEvent.GetSafeCustomField<string>("BusinessCategory")) case "1": //Business Planning thisEvent.Parent = manager.GetCalendars().Where(c => c.Title == "Business Planning").FirstOrDefault(); manager.SaveChanges(); break; case "2": //Funding/Accounting thisEvent.Parent = manager.GetCalendars().Where(c => c.Title == "Funding/Accounting").FirstOrDefault(); manager.SaveChanges(); break; default: break; Hello Mark,
Try getting the events list at the beginning with the Native API like so:
var events = manager.GetEvents().Where(ev => ev.Status == ContentLifecycleStatus.Master).ToList();Careful of the evil ".ToList();" :)