예제 #1
0
        /// <summary>
        /// Find users by login id , supports wild card search
        /// </summary>
        /// <param name="samAccountName"></param>
        /// <returns></returns>
        public List <ADUser> SearchUsersByLogin(string samAccountName)
        {
            try
            {
                var searcher = new RealPrincipalSearcher();
                ActiveDirectoryHelper helper = new ActiveDirectoryHelper(searcher);
                return(helper.SearchUsersByLoginId(samAccountName));
            }
            catch (Exception ex)
            {
                /*log erorr locally */
                string    message = string.Format("Error in  SearchUsersByLogin(string samAccountName:{0} Detailed exception:{1}", samAccountName, ex.ToString());
                Exception custom  = new Exception(message);
                ExceptionManager.HandleException(custom);

                ServiceErrorFault fault = new ServiceErrorFault();
                fault.Operation   = "Directory Service";
                fault.ProblemType = "Error in SearchUsersByLogin";

                throw new FaultException <ServiceErrorFault>(fault);
            }
        }