예제 #1
0
        /// <summary>
        /// Returns the free busy times for the specified exchange users
        /// </summary>
        /// <param name="user">The user which free/busy blocks will be looked up for</param>
        /// <param name="window">The date range to do the lookup</param>
        /// <returns>FreeBusy data for user in the daterange</returns>
        public FreeBusy LookupFreeBusyTimes(ExchangeUser user, DateTimeRange window)
        {
            ExchangeUserDict users = new ExchangeUserDict();

            users.Add(user.Email, user);

            Dictionary <ExchangeUser, FreeBusy> result = LookupFreeBusyTimes(users, window);

            return(result[user]);
        }
예제 #2
0
        private ExchangeUserDict CreateExchangeUserCollection(SearchResultCollection searchResults)
        {
            ExchangeUserDict userCollection = new ExchangeUserDict();

            if (searchResults != null)
            {
                /* For each result set in the result set */
                foreach (System.DirectoryServices.SearchResult result in searchResults)
                {
                    /* Extract the property collection and create a new exchange user with it
                     * Add the new user to the result set and use the account name as the index for
                     * the dictionary collection */
                    ResultPropertyCollection property = result.Properties;
                    ExchangeUser             user     = new ExchangeUser(property);

                    if (!user.IsValid)
                    {
                        log.WarnFormat("User '{0}' is invalid and will not be synchronized.", user.CommonName);
                    }
                    else if (userCollection.ContainsKey(user.Email.ToLower()))
                    {
                        log.WarnFormat("User '{0}' was returned multiple times in the LDAP query. " +
                                       "Only the first instance was added.", user.Email);
                    }
                    else
                    {
                        userCollection.Add(user.Email.ToLower(), user);
                        log.InfoFormat("Found and added '{0}' as an ExchangeUser.", user.Email);
                    }

                    log.DebugFormat("LDAP object debug info: {0}", user);
                }
            }

            return(userCollection);
        }