internal static DirectoryEntryHolder GetDirectoryEntry(DirectoryInformation directoryInfo, string objectDN, bool revertImpersonation)
        {
            Debug.Assert((objectDN != null) && (objectDN.Length != 0));

            //
            // Get the adspath and create a directory entry holder
            //
            DirectoryEntryHolder holder = new DirectoryEntryHolder(new DirectoryEntry(
                                                                       directoryInfo.GetADsPath(objectDN),
                                                                       directoryInfo.GetUsername(),
                                                                       directoryInfo.GetPassword(),
                                                                       directoryInfo.AuthenticationTypes));

            //
            // If  revertImpersonation is true, we need to revert
            //
            holder.Open(null, revertImpersonation);
            return(holder);
        }
        internal static DirectoryEntryHolder GetDirectoryEntry(DirectoryInformation directoryInfo, string objectDN, bool revertImpersonation)
        {
            DirectoryEntryHolder holder = new DirectoryEntryHolder(new DirectoryEntry(directoryInfo.GetADsPath(objectDN), directoryInfo.GetUsername(), directoryInfo.GetPassword(), directoryInfo.AuthenticationTypes));

            holder.Open(null, revertImpersonation);
            return(holder);
        }