Why am I getting errors when I want to rebuild the TreeView contro



Hi, I'm able to get the Domain object using GetDomain . I want to rebuild my
tree using this new domain so I pass in the new DNS. I update that in the
DirectoryEntry object's path. But I'm getting the following error message:

DirectoryServicesCOMException(ox8007202B): A referral was returned from the
server.

The error occurs at
"foreach (DirectoryEntry child in deContexts.Children)"


Can someone see what I need to corret here? Thanks.
---------------------------------------------------
public void InitTree(string domainName)
{
string newDomain = domainName;


//Obtain and lists all the contexts nodes
contextPath = "CN=Contexts,CN=Unity,CN=Symark,CN=Program Data,"
+ newDomain;
globalPath = "CN=Global,CN=Unity,CN=Symark,CN=Program Data,"
+ newDomain;
defaultPath = "CN=Contexts,
CN=DEFAULTS,CN=Unity,CN=Symark,CN=Program Data,"
+ newDomain;

try
{
deContexts.Path = "LDAP://"; + contextPath;
string path = deContexts.Path;
}
catch (System.Exception e)
{
MessageBox.Show(e.ToString(), "PowerADvantage");
return;
}

this.ppTree.Nodes.Clear();
this.ppTree.ImageList = unityImageList;

// Set the TreeView control's default image and selected image
indexes.
this.ppTree.ImageIndex = 0;
this.ppTree.SelectedImageIndex = 1;


TreeNode unityNode = new TreeNode("PowerADvantage
Administration", 5, 5);
unityNode.Name = "PowerADvantage Administration";
this.ppTree.Nodes.Add(unityNode);


//Tag the 1st Tree Node
this.ppTree.Nodes[0].Tag = new TreeNodeInfo(deContexts.Path,
true);
int index = 0;
TreeNode tn = unityNode.Nodes.Add("domainRoot", "Contexts", 6, 6);
tn.Name = "Contexts";

tn.Tag = new TreeNodeInfo(deContexts.Path, true);
TreeNodeInfo nodeInfo = (TreeNodeInfo)tn.Tag;
//this.ppTree.SelectedNode = unityNode;

//Populate the tree nodes
try
{
foreach (DirectoryEntry child in deContexts.Children)
{
string delimStr = "=";
char[] delimiter = delimStr.ToCharArray();
string[] split = null;
split = child.Name.Split(delimiter, 2);

index = tn.Nodes.Add(new TreeNode(split[1].ToString(),
0, 1));
tn.Nodes[index].Tag = new TreeNodeInfo(child.Path, false);
tn.Nodes[index].Name = split[1].ToString();

}
}
catch (System.Exception e)
{
MessageBox.Show(e.ToString(), "PowerADvantage");
}
//Add the Reports node
TreeNode reportNode = new TreeNode("Reports", 8, 8);
TreeNode licensesNode = new TreeNode("Licenses", 10, 10);

//TreeNode computerDetail = new TreeNode("Computers - Detail",
9, 9);
//TreeNode groupDetailDetail = new TreeNode("Groups - Detail",
9, 9);
//TreeNode userDetail = new TreeNode("Users - Detail", 9, 9);
//TreeNode contextsDetail = new TreeNode("Contexts - Detail", 9,
9);

unityNode.Nodes.Add(reportNode);
//reportNode.Nodes.Add(computerDetail);
//reportNode.Nodes.Add(groupDetailDetail);
//reportNode.Nodes.Add(userDetail);
//reportNode.Nodes.Add(contextsDetail);
unityNode.Nodes.Add(licensesNode);

curDomain = newDomain;
nodeInfo.isLoaded = true;
this.ppTree.ExpandAll();
}

--
Thanks.
.



Relevant Pages

  • Re: convert a list to tree
    ... the input is a list node and the output is a tree ... contains the tree node addresses. ... list node we look up the tree nodes for the item id and the parent id. ... might have a list of components and subsystems. ...
    (comp.lang.c)
  • Re: convert a list to tree
    ... the input is a list node and the output is a tree ... contains the tree node addresses. ... list node we look up the tree nodes for the item id and the parent id. ... might have a list of components and subsystems. ...
    (comp.programming)
  • Re: Why am I getting errors when I want to rebuild the TreeView contro
    ... You need to add the DNS domain name of the domain you want to access to the ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ... string newDomain = domainName; ... //Tag the 1st Tree Node ...
    (microsoft.public.dotnet.security)
  • Re: Tree Problem
    ... > || I'm trying to build a tree structure, and one thing I'm finding I need ... > | for UserSub you are allowed to USE the type definition module, ... What if you made the tree node definition more general so that the same derived type ... pointers could be the equivalent next and previous pointers? ...
    (comp.lang.fortran)
  • RE: Multi Icon Tree View
    ... Dim tvw as New TreeView ... // Create a new Tree Node ... >Subject: Multi Icon Tree View ...
    (microsoft.public.dotnet.framework.windowsforms.controls)