Delete calendars

If you need to delete a calendar you can use the DeleteCalendarmethod of the EventsManager:

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Telerik.Sitefinity.Modules.Events;

namespace Telerik.Sitefinity.Documentation.CodeSnippets.DevGuide.SitefinityEssentials.Modules.Events.Calendars
{
    public partial class CalendarSnippets
    {
        public static void DeleteCalendar(Guid calendarId)
        {
            var manager = EventsManager.GetManager();

            var calendarItem = manager.GetCalendars().SingleOrDefault(e => e.Id == calendarId);
            if (calendarItem != null)
            {
                manager.DeleteCalendar(calendarItem);
                manager.SaveChanges();
            }
        }
    }
}
Want to learn more?
Enhance your Sitefinity skills by enrolling in free training sessions. Become Sitefinity certified through Progress Education Community to strengthen your professional credentials.
New to Sitefinity?