private static TreeObject GetTreeObject(DirectoryEntry Entry) { var tree = new TreeObject(); tree.label = GetProperty(Entry, "name"); if (string.IsNullOrEmpty(tree.label) || IgnoresList.Contains(tree.label)||"内部用户"==tree.label) { return null; } var description = GetProperty(Entry, "description"); if (!string.IsNullOrEmpty(description)) { tree.label += "--" + description; } foreach (DirectoryEntry item in Entry.Children) { var temp = GetTreeObject(item); if (temp != null) { tree.children.Add(temp); } } return tree; }
public static TreeObject GetTreeObject() { var tree = new TreeObject(); var admin = GetDirectoryObject(); tree.label = GetProperty(admin, "name"); var description = GetProperty(admin, "description"); if (!string.IsNullOrEmpty(description)) { tree.label += "--" + description; } foreach (DirectoryEntry child in admin.Children) { var temp = GetTreeObject(child); if (temp != null) { tree.children.Add(temp); } } return tree; }