/// <summary>
        /// Get a free busy writer for the set of users
        /// </summary>
        /// <param name="users">List of the users to write f/b info for</param>
        /// <returns>A FreeBusyWriter</returns>
        public static IFreeBusyWriter GetWriter(List<ExchangeUser> users)
        {
            IFreeBusyWriter writer = null;

            switch ( ConfigCache.FreeBusyWriter.ToUpperInvariant() )
            {
                default:
                case "SCHEDULEPLUS":
                    writer = new SchedulePlusFreeBusyWriter();
                    break;
                case "APPOINTMENT":
                    writer = new AppointmentWriter();
                    break;
            }

            return writer;
        }
Пример #2
0
        /// <summary>
        /// Get a free busy writer for the set of users
        /// </summary>
        /// <param name="users">List of the users to write f/b info for</param>
        /// <returns>A FreeBusyWriter</returns>
        public static IFreeBusyWriter GetWriter(List <ExchangeUser> users)
        {
            IFreeBusyWriter writer = null;

            switch (ConfigCache.FreeBusyWriter.ToUpperInvariant())
            {
            default:
            case "SCHEDULEPLUS":
                writer = new SchedulePlusFreeBusyWriter();
                break;

            case "APPOINTMENT":
                writer = new AppointmentWriter();
                break;
            }

            return(writer);
        }
        public static void WriteFreeBusyMessage( string commonName )
        {
            ExchangeService gw = new ExchangeService(
                ConfigCache.ExchangeFreeBusyServerUrl,
                ConfigCache.ExchangeUserLogin,
                ConfigCache.ExchangeUserPassword );

            SchedulePlusFreeBusyWriter writer =
                new SchedulePlusFreeBusyWriter();

            ExchangeUserDict users = QueryFreeBusy(commonName);
            if (users.Count < 1)
            {
                string msg = string.Format("User {0} not found", commonName);
                throw new Exception(msg);
            }

            if (users.Count > 1)
            {
                string msg = string.Format("More than one user matches {0}", commonName);
                throw new Exception(msg);
            }

            string userFreeBusyUrl = FreeBusyUrl.GenerateUrlFromDN(
                ConfigCache.ExchangeFreeBusyServerUrl,
                users[commonName].LegacyExchangeDN);

            List<string> emtpyList = new List<string>();
            string nowMinus30Days =
                FreeBusyConverter.ConvertToSysTime(DateUtil.NowUtc.AddDays(-30)).ToString();
            string nowPlus60Days =
                FreeBusyConverter.ConvertToSysTime(DateUtil.NowUtc.AddDays(60)).ToString();

            gw.FreeBusy.CreateFreeBusyMessage(userFreeBusyUrl,
                                              commonName,
                                              emtpyList,
                                              emtpyList,
                                              emtpyList,
                                              emtpyList,
                                              nowMinus30Days,
                                              nowPlus60Days);
        }