Skip to content

Commit

Permalink
Correctly shows OU objects when attempting to remove OU now
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven-D-Foster committed Jun 3, 2021
1 parent 3669c05 commit 33f7f47
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,14 @@ public IEnumerable<ActiveDirectoryObject> Children
{
var de = o as System.DirectoryServices.DirectoryEntry;
if (de == null) continue; // TODO: Could we get other object types?
var dn = de.Properties["distinguishedName"].ToStringGuessFormat().TrimOrNull();
var dnCollection = de.Properties["distinguishedName"];
object dnObj = null;
foreach (var dnCollectionObj in dnCollection)
{
if (dnObj == null) dnObj = dnCollectionObj;
}

var dn = dnObj.ToStringGuessFormat().TrimOrNull();
if (dn == null) continue;
var ado = activeDirectory.GetObjectByDistinguishedName(dn);
if (ado == null) continue; // should not happen
Expand Down

0 comments on commit 33f7f47

Please sign in to comment.