public static void EnableBirthdayCalendar(MailboxSession session)
 {
     if (!BirthdayCalendar.UserHasBirthdayCalendarFolder(session))
     {
         ExTraceGlobals.BirthdayCalendarTracer.TraceDebug <Guid>(0L, "BirthdayCalendar::EnableBirthdayCalendar CreateDefaultFolder. MailboxGuid:{0}", session.MailboxGuid);
         session.CreateDefaultFolder(DefaultFolderType.BirthdayCalendar);
         return;
     }
     ExTraceGlobals.BirthdayCalendarTracer.TraceDebug <Guid>(0L, "BirthdayCalendar::EnableBirthdayCalendar BindWithRecovery. MailboxGuid:{0}", session.MailboxGuid);
     BirthdayCalendar.BindWithRecovery(session, delegate(CalendarFolder birthdayCalendar)
     {
         BirthdayCalendar.SetBirthdayCalendarHiddenValue(birthdayCalendar, false);
     });
 }
        public static void DisableBirthdayCalendar(MailboxSession session)
        {
            ExTraceGlobals.BirthdayCalendarTracer.TraceDebug <Guid>(0L, "BirthdayCalendar::DisableBirthdayCalendar. MailboxGuid:{0}", session.MailboxGuid);
            StoreObjectId birthdayCalendarFolderId = BirthdayCalendar.GetBirthdayCalendarFolderId(session);

            if (birthdayCalendarFolderId == null)
            {
                ExTraceGlobals.BirthdayCalendarTracer.TraceDebug <Guid>(0L, "BirthdayCalendar::DisableBirthdayCalendar. Folder doesn't exist. MailboxGuid:{0}", session.MailboxGuid);
                return;
            }
            try
            {
                ExTraceGlobals.BirthdayCalendarTracer.TraceDebug <Guid>(0L, "BirthdayCalendar::DisableBirthdayCalendar. Set IsHidden. MailboxGuid:{0}", session.MailboxGuid);
                using (CalendarFolder calendarFolder = CalendarFolder.Bind(session, birthdayCalendarFolderId))
                {
                    BirthdayCalendar.SetBirthdayCalendarHiddenValue(calendarFolder, true);
                }
            }
            catch (ObjectNotFoundException)
            {
                ExTraceGlobals.BirthdayCalendarTracer.TraceDebug <Guid>(0L, "BirthdayCalendar::DisableBirthdayCalendar. ObjectNotFoundException. MailboxGuid:{0}", session.MailboxGuid);
            }
        }
 public static bool UserHasBirthdayCalendarFolder(MailboxSession session)
 {
     return(BirthdayCalendar.GetBirthdayCalendarFolderId(session) != null);
 }