Exemple #1
0
        /// <summary>
        /// Verify whether the AD object with the object guid exists.
        /// </summary>
        /// <param name="adOperator">The AD operator.</param>
        /// <param name="objectGuid">The AD object guid.</param>
        /// <returns>Whether the AD Object exists.</returns>
        public static bool DoesADObjectExists(IADOperator adOperator, Guid objectGuid)
        {
            bool doesADObjectExists;

            using (var objectGuidDirectoryEntryRepository = new ObjectGUIDDirectoryEntryRepository(adOperator, objectGuid))
            {
                doesADObjectExists = objectGuidDirectoryEntryRepository.Exists;
            }
            return(doesADObjectExists);
        }
Exemple #2
0
        /// <summary>
        /// Find one AD object by objectGUID.
        /// </summary>
        /// <param name="adOperator">The AD operator.</param>
        /// <param name="objectGuid">The objectGUID.</param>
        /// <returns>One AD object.</returns>
        public static ADObject FindOneByObjectGUID(IADOperator adOperator, Guid objectGuid)
        {
            ADObject adObject = null;

            using (var objectGuidDirectoryEntryRepository = new ObjectGUIDDirectoryEntryRepository(adOperator, objectGuid))
            {
                if (objectGuidDirectoryEntryRepository.Exists)
                {
                    adObject = GetADObject(adOperator, objectGuidDirectoryEntryRepository.GetSearchResult());
                }
            }
            return(adObject);
        }