Пример #1
0
        /// <summary>Returns whether a location is available in Outlook.</summary>
        /// <param name="startDate">The start date.</param>
        /// <param name="location">The location.</param>
        /// <param name="application">The Outlook application.</param>
        /// <returns>Boolean whether the location is free.</returns>
        private bool LocationIsFree(DateTime startDate, string location, Outlook.Application application)
        {
            Outlook.Recipient loc = application.Session.CreateRecipient(location);
            var freeHalfas        = loc.FreeBusy(startDate, 30, true).Substring(0, 48);
            var timeInHalfas      = (startDate.TimeOfDay.Hours * 2) + (startDate.TimeOfDay.Minutes / 30);

            return(freeHalfas[timeInHalfas].ToString() == "0");
        }