I followed the instructions from "Walkthrough: Viewing Local Directory
Objects" copying the source directly from there and replacing the domain with
my organization's domain and YourComputerName with my computer's name.
The spot where it errors is in Form1_Load at the foreach statement
specifically on the entryPC.Children
private void Form1_Load(object sender, System.EventArgs e)
{
TreeNode users = new TreeNode("Users");
TreeNode groups = new TreeNode("Groups");
TreeNode services = new TreeNode("Services");
viewPC.Nodes.AddRange(new TreeNode[] { users, groups, services });
foreach(System.DirectoryServices.DirectoryEntry child
in entryPC.Children)
{
TreeNode newNode = new TreeNode(child.Name);
switch (child.SchemaClassName)
{
case "User" :
users.Nodes.Add(newNode);
break;
case "Group" :
groups.Nodes.Add(newNode);
break;
case "Service" :
services.Nodes.Add(newNode);
break;
}
AddPathAndProperties(newNode, child);
}
}
"Willy Denoyette [MVP]" wrote:
"Frank_00001" <Fr*********@discussions.microsoft.com> wrote in message
news:F4**********************************@microsof t.com... I'm going to need to get a list of users for an upcoming project and
Active
Directory seems to be a good place to get it. I'm trying to get the
"Walkthrough: Viewing Local Directory Objects" example to work; but I keep
getting...
An unhandled exception of type
'System.Runtime.InteropServices.COMException'
occurred in system.directoryservices.dll
Additional information: Unspecified error
I've tried a few things and nothing I do seems to work. Does anyone know
what the problem might be?
Without seeing your code and the point that it fails? No.
Willy.