<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Display CRM Business Unit Organization Hierarchy in a TreeView</title><link>http://blogs.msdn.com/benlec/pages/display-crm-business-unit-organization-hierarchy-in-a-treeview.aspx</link><description>Hi guys, I've see several people and customer requested this feature in CRM. The hiearchical view of BU in CRM is not something provided out of the box and I don't understand why because it could be very handy. The CRM SDK offers the possibility to do</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>New CRM 3.0 SDK Article (How to generate Hiearchical View of CRM 3.0 Business Units)</title><link>http://blogs.msdn.com/benlec/pages/display-crm-business-unit-organization-hierarchy-in-a-treeview.aspx#2010897</link><pubDate>Mon, 02 Apr 2007 12:57:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2010897</guid><dc:creator>Microsoft CRM Support Tools Info</dc:creator><description>&lt;p&gt;Here it is: &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/benlec/pages/display-crm-business-unit-organization-hierarchy-in-a-treeview.aspx"&gt;http://blogs.msdn.com/benlec/pages/display-crm-business-unit-organization-hierarchy-in-a-treeview.aspx&lt;/a&gt;&lt;/p&gt;</description></item><item><title>re: Display CRM Business Unit Organization Hierarchy in a TreeView</title><link>http://blogs.msdn.com/benlec/pages/display-crm-business-unit-organization-hierarchy-in-a-treeview.aspx#2176887</link><pubDate>Wed, 18 Apr 2007 19:02:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2176887</guid><dc:creator>Peter Lynch</dc:creator><description>&lt;p&gt;Thanks - very handy&lt;/p&gt;</description></item><item><title>re: Display CRM Business Unit Organization Hierarchy in a TreeView</title><link>http://blogs.msdn.com/benlec/pages/display-crm-business-unit-organization-hierarchy-in-a-treeview.aspx#2519852</link><pubDate>Thu, 10 May 2007 11:26:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2519852</guid><dc:creator>Olga</dc:creator><description>&lt;p&gt;This is great! &amp;nbsp;Thanks a million for this Benjamin!&lt;/p&gt;</description></item><item><title>re: Display CRM Business Unit Organization Hierarchy in a TreeView</title><link>http://blogs.msdn.com/benlec/pages/display-crm-business-unit-organization-hierarchy-in-a-treeview.aspx#3160765</link><pubDate>Fri, 08 Jun 2007 15:13:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3160765</guid><dc:creator>Christian</dc:creator><description>&lt;P&gt;Hi!&lt;/P&gt;
&lt;P&gt;Great idea!&lt;/P&gt;
&lt;P&gt;I just added some fetchxml for retrieving the uppermost businessunit automatically. This makes the use of the tool more handy over diffrent systems...&lt;/P&gt;
&lt;P&gt;---&lt;/P&gt;
&lt;P&gt;// Here you need to pass the Root BusinessUnitId you can find within MSCRMDb from a simple SQL Query&lt;/P&gt;
&lt;P&gt;// SELECT BusinessUnitId FROM BusinessUnitBase WHERE CREATEDBY IS NULL&lt;/P&gt;
&lt;P&gt;// retrieve.EntityId = new Guid("C1D98250-C0DE-DB11-BA56-0003FFA73EB9"); &lt;/P&gt;
&lt;P&gt;// retrieve.EntityId = new Guid("B1170AE7-0B9F-DA11-8444-0003FF166C81");&lt;/P&gt;
&lt;P&gt;// cl: using fetchxml for that job...&lt;/P&gt;
&lt;P&gt;const string BUSINESSUNITID = "businessunitid";&lt;/P&gt;
&lt;P&gt;string ls_fetchroot = string.Format(@"&amp;lt;fetch mapping=""logical""&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;entity name=""businessunit""&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;attribute name=""{0}""/&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;filter type=""and""&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;condition attribute=""createdby"" operator=""null""/&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/filter&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/entity&amp;gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/fetch&amp;gt;",BUSINESSUNITID);&lt;/P&gt;
&lt;P&gt;String ls_rootxml = mysvc.Fetch(ls_fetchroot);&lt;/P&gt;
&lt;P&gt;System.Xml.XmlDocument lo_mydoc = new System.Xml.XmlDocument();&lt;/P&gt;
&lt;P&gt;lo_mydoc.LoadXml(ls_rootxml);&lt;/P&gt;
&lt;P&gt;// some tests should be performed, whether everything is ok here...&lt;/P&gt;
&lt;P&gt;retrieve.EntityId = new Guid(lo_mydoc.SelectSingleNode("//resultset/result/" + BUSINESSUNITID).InnerXml);&lt;/P&gt;</description></item><item><title>re: Display CRM Business Unit Organization Hierarchy in a TreeView</title><link>http://blogs.msdn.com/benlec/pages/display-crm-business-unit-organization-hierarchy-in-a-treeview.aspx#3186214</link><pubDate>Sat, 09 Jun 2007 19:37:01 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3186214</guid><dc:creator>benlec</dc:creator><description>&lt;p&gt;Christian,&lt;/p&gt;
&lt;p&gt;This is great, thank you so much to contribute!&lt;/p&gt;
</description></item><item><title>re: Display CRM Business Unit Organization Hierarchy in a TreeView</title><link>http://blogs.msdn.com/benlec/pages/display-crm-business-unit-organization-hierarchy-in-a-treeview.aspx#5296286</link><pubDate>Fri, 05 Oct 2007 20:10:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5296286</guid><dc:creator>rodney_viana</dc:creator><description>&lt;p&gt;How can I show all contacts in a Business Unit?&lt;/p&gt;
&lt;p&gt;Thanks,&lt;/p&gt;
&lt;p&gt;Rodney Viana&lt;/p&gt;
</description></item><item><title>re: Display CRM Business Unit Organization Hierarchy in a TreeView</title><link>http://blogs.msdn.com/benlec/pages/display-crm-business-unit-organization-hierarchy-in-a-treeview.aspx#5364642</link><pubDate>Mon, 08 Oct 2007 17:27:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5364642</guid><dc:creator>Christian</dc:creator><description>&lt;p&gt;Hallo Rodney!&lt;/p&gt;
&lt;p&gt;In principle, showing contacts is possible with retrieving the contacts via fetchxml. I changed the code a litte bit. The codesnippet shown replaces the getchildbu method and the initalisation of the service in the 'MAIN' function retrivebeuhierarchy.&lt;/p&gt;
&lt;p&gt;I also added a new picture in the imagelist1 object, in order to distinguish between a businessunit and a contact.&lt;/p&gt;
&lt;p&gt;But: this can be quite slow, because _all_ contacts are retrieved. This can be a great amount. The better approach would be to have an event on the node. EG when rightclicked, load all contacts and show them..&lt;/p&gt;
&lt;p&gt;But may be, this idea helps a little bit.&lt;/p&gt;
&lt;p&gt;---cut here---cut here---cut here---&lt;/p&gt;
&lt;p&gt;		string is_contactfetchpattern = @&amp;quot;&amp;lt;fetch mapping=&amp;quot;&amp;quot;logical&amp;quot;&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;entity name=&amp;quot;&amp;quot;contact&amp;quot;&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;attribute name=&amp;quot;&amp;quot;fullname&amp;quot;&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;filter type=&amp;quot;&amp;quot;and&amp;quot;&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;condition attribute=&amp;quot;&amp;quot;owningbusinessunit&amp;quot;&amp;quot; operator=&amp;quot;&amp;quot;eq&amp;quot;&amp;quot; value=&amp;quot;&amp;quot;{0}&amp;quot;&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/filter&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;lt;/entity&amp;gt;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/fetch&amp;gt;&amp;quot;;&lt;/p&gt;
&lt;p&gt;		CrmService mysvc;&lt;/p&gt;
&lt;p&gt;		// This function implements the test logic to find which are the childs of the current BU.&lt;/p&gt;
&lt;p&gt;		public void GetChildBu(Guid myBUid, TreeNode myBUNode,RetrieveBusinessHierarchyBusinessUnitResponse allBu)&lt;/p&gt;
&lt;p&gt;		{&lt;/p&gt;
&lt;p&gt;			System.Xml.XmlDocument lo_tmp = new System.Xml.XmlDocument();&lt;/p&gt;
&lt;p&gt;			TreeNode tn_tmp;&lt;/p&gt;
&lt;p&gt;			foreach (businessunit bu in allBu.BusinessEntityCollection.BusinessEntities)&lt;/p&gt;
&lt;p&gt;			{&lt;/p&gt;
&lt;p&gt;				if(bu.parentbusinessunitid!=null) // we skeep the root bu.....&lt;/p&gt;
&lt;p&gt;				{&lt;/p&gt;
&lt;p&gt;					Guid currentBUid = bu.businessunitid.Value;&lt;/p&gt;
&lt;p&gt;					Guid currentBUparentBUid = bu.parentbusinessunitid.Value;&lt;/p&gt;
&lt;p&gt;					if(currentBUparentBUid == myBUid)&lt;/p&gt;
&lt;p&gt;					{&lt;/p&gt;
&lt;p&gt;						// Add each child to the treeview.&lt;/p&gt;
&lt;p&gt;						TreeNode myBUNode2 = myBUNode.Nodes.Add(bu.name.ToString());&lt;/p&gt;
&lt;p&gt;						// add the contacs for this bu...&lt;/p&gt;
&lt;p&gt;						lo_tmp.LoadXml( mysvc.Fetch(string.Format(is_contactfetchpattern,currentBUid)));&lt;/p&gt;
&lt;p&gt;						foreach (System.Xml.XmlNode anode in lo_tmp.SelectNodes(&amp;quot;//resultset/result&amp;quot;))&lt;/p&gt;
&lt;p&gt;						{&lt;/p&gt;
&lt;p&gt;							tn_tmp = myBUNode.Nodes.Add(anode.FirstChild.FirstChild.InnerText );&lt;/p&gt;
&lt;p&gt;							tn_tmp.ImageIndex=1;&lt;/p&gt;
&lt;p&gt;						}&lt;/p&gt;
&lt;p&gt;						// Loop again into the function........&lt;/p&gt;
&lt;p&gt;						GetChildBu(currentBUid,myBUNode2,allBu);&lt;/p&gt;
&lt;p&gt;					}&lt;/p&gt;
&lt;p&gt;				}&lt;/p&gt;
&lt;p&gt;			}&lt;/p&gt;
&lt;p&gt;		}&lt;/p&gt;
&lt;p&gt;		// This is the MAIN function needed to be triggered by the Button on your form.&lt;/p&gt;
&lt;p&gt;		public void RetrieveHierachy()&lt;/p&gt;
&lt;p&gt;		{&lt;/p&gt;
&lt;p&gt;			// Init the WebService......				&lt;/p&gt;
&lt;p&gt;			mysvc = InitSvc();&lt;/p&gt;
&lt;p&gt;---cut here---cut here---cut here---&lt;/p&gt;</description></item><item><title>re: Display CRM Business Unit Organization Hierarchy in a TreeView</title><link>http://blogs.msdn.com/benlec/pages/display-crm-business-unit-organization-hierarchy-in-a-treeview.aspx#5386703</link><pubDate>Wed, 10 Oct 2007 02:17:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5386703</guid><dc:creator>rodney_viana</dc:creator><description>&lt;p&gt;Hi Christian,&lt;/p&gt;
&lt;p&gt;Thanks you very much for your time. I have solved the problem already. I have used a query to fetch only the users where owningbusinessunit is the current business unit like you did. My code is for ASP.NET and slightly different, but I am sharing the code (it can be easily ported to Windows form) since your answer to this post explaining how to get the root business object helped me a lot to finish my project. Please let me know what you think. I am new to CRM and your feedback will be very important. I found out how to create a link to the account but not to the business unit. Do you know how to do this?&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;private void GetContacts(string BusinessID, TreeNode myBUNode, bool hasChildren)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;string fetchXml = String.Format(@&amp;quot;&lt;/p&gt;
&lt;p&gt;				&amp;lt;fetch mapping=&amp;quot;&amp;quot;logical&amp;quot;&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;				&amp;lt;entity name=&amp;quot;&amp;quot;contact&amp;quot;&amp;quot;&amp;gt;&lt;/p&gt;
&lt;p&gt;				&amp;lt;attribute name=&amp;quot;&amp;quot;contactid&amp;quot;&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;				&amp;lt;attribute name=&amp;quot;&amp;quot;fullname&amp;quot;&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;				&amp;lt;attribute name=&amp;quot;&amp;quot;owningbusinessunit&amp;quot;&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;				&amp;lt;filter&amp;gt;&lt;/p&gt;
&lt;p&gt;				&amp;lt;condition attribute=&amp;quot;&amp;quot;owningbusinessunit&amp;quot;&amp;quot; operator=&amp;quot;&amp;quot;eq&amp;quot;&amp;quot; value=&amp;quot;&amp;quot;{0}&amp;quot;&amp;quot; /&amp;gt;&lt;/p&gt;
&lt;p&gt;				&amp;lt;/filter&amp;gt;&lt;/p&gt;
&lt;p&gt;				&amp;lt;/entity&amp;gt;&lt;/p&gt;
&lt;p&gt;				&amp;lt;/fetch&amp;gt;&lt;/p&gt;
&lt;p&gt;				&amp;quot;, &amp;quot;{&amp;quot; + BusinessID + &amp;quot;}&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;String xmlResult = mysvc.Fetch(fetchXml);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;System.Xml.XmlDocument xmlContacts = new System.Xml.XmlDocument();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;xmlContacts.LoadXml(xmlResult);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bool child = hasChildren;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;foreach (System.Xml.XmlNode xn in xmlContacts.SelectNodes(&amp;quot;//resultset/result&amp;quot;))&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;child = true;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TreeNode node = new TreeNode(xn.ChildNodes[1].InnerText, null, null, String.Format(&amp;quot;&lt;a rel="nofollow" target="_new" href="http://crm/sfa/conts/edit.aspx?id="&gt;http://crm/sfa/conts/edit.aspx?id=&lt;/a&gt;{0}&amp;quot;, xn.ChildNodes[0].InnerText), null);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;myBUNode.ChildNodes.Add(node);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (!child)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TreeNode node = new TreeNode(&amp;quot;(no contact)&amp;quot;);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;myBUNode.ChildNodes.Add(node);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;// This function implements the test logic to find which are the childs of the current BU.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;public bool GetChildBu(Guid myBUid, TreeNode myBUNode, RetrieveBusinessHierarchyBusinessUnitResponse allBu)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bool child = false;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;foreach (businessunit bu in allBu.BusinessEntityCollection.BusinessEntities)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (bu.parentbusinessunitid != null) // we skip the root bu.....&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Guid currentBUid = bu.businessunitid.Value;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Guid currentBUparentBUid = bu.parentbusinessunitid.Value;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (currentBUparentBUid == myBUid)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;child = true;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Add each child to the treeview.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;TreeNode myBUNode2 = new TreeNode(bu.name.ToString());&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;myBUNode.ChildNodes.Add(myBUNode2);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// Loop again into the function........&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bool hasChildren = GetChildBu(currentBUid, myBUNode2, allBu);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;GetContacts(bu.businessunitid.Value.ToString(), myBUNode2, hasChildren);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return child;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;</description></item><item><title>re: Display CRM Business Unit Organization Hierarchy in a TreeView</title><link>http://blogs.msdn.com/benlec/pages/display-crm-business-unit-organization-hierarchy-in-a-treeview.aspx#5400727</link><pubDate>Thu, 11 Oct 2007 15:03:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5400727</guid><dc:creator>Christian</dc:creator><description>&lt;p&gt;Hallo Rodney!&lt;/p&gt;
&lt;p&gt;We obviously both found the same solution on the Problem. So i am not wrong with it ;-). In Fact, it should be ok to search the contacts while running recursively through the tree.&lt;/p&gt;
&lt;p&gt;Have you ever thougt about showing this type of information in an hyperbolic view like e.g. &lt;a rel="nofollow" target="_new" href="http://hypergraph.sourceforge.net/index.html"&gt;http://hypergraph.sourceforge.net/index.html&lt;/a&gt; ? One could get all connections from contacts to accounts to businessunits over this view. Away from the standardtreedisplay. Ok. This does not fit perfectly, because one contact may not be related to many BUs or accounts. But this could help for relationships...&lt;/p&gt;
&lt;p&gt;Concerning the businessunitdisplay: you are right. I did not find a standardway to display the information. &amp;nbsp;I think this is driven by the fact, that single users should not be able to change the BU of an object within crm (directly), because the BU could drive the distribution of the data. And there is no way to disallow editing a single attribute or relationship in the standardviews. So i think, one has to create a mask byself... (but i did not make any research on this topic)&lt;/p&gt;
&lt;p&gt;ciao,&lt;/p&gt;
&lt;p&gt; &amp;nbsp;christian&lt;/p&gt;
&lt;p&gt;PS you can also contact me via email if you like: christian.leverenz (at) orbis.de (or private by christian (at) leverenz.de ;-) )&lt;/p&gt;</description></item><item><title>re: Display CRM Business Unit Organization Hierarchy in a TreeView</title><link>http://blogs.msdn.com/benlec/pages/display-crm-business-unit-organization-hierarchy-in-a-treeview.aspx#5400962</link><pubDate>Thu, 11 Oct 2007 15:40:56 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5400962</guid><dc:creator>christian</dc:creator><description>&lt;p&gt;while washing hands, i had an idea for the businessunits. The crm system itself uses something like:&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://localhost/biz/business/edit.aspx?id="&gt;http://localhost/biz/business/edit.aspx?id=&lt;/a&gt;{A94DDCA3-B5A2-DA11-8FEA-0003FF166C81}&lt;/p&gt;
&lt;p&gt;But this is definitely undocumented and therefore unsupported ;-)))&lt;/p&gt;
&lt;p&gt;cheers,&lt;/p&gt;
&lt;p&gt; &amp;nbsp;christian&lt;/p&gt;</description></item><item><title>re: Display CRM Business Unit Organization Hierarchy in a TreeView</title><link>http://blogs.msdn.com/benlec/pages/display-crm-business-unit-organization-hierarchy-in-a-treeview.aspx#5456766</link><pubDate>Mon, 15 Oct 2007 06:13:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:5456766</guid><dc:creator>rodney_viana</dc:creator><description>&lt;p&gt;Christian,&lt;/p&gt;
&lt;p&gt;Thanks for the support and new ideas. The business unit thing is really undocumented, I am saving this info. I finished the project and the client told me he wanted a hierarchy of relationships instead. I already delivered the new requirement. The strange thing is that I knew nothing about CRM before. Now I am feeling confortable. I am working in a new video for my blog that will join CRM and MOSS 2007. I will let you know when I post it. Thanks I will keep in touch.&lt;/p&gt;</description></item></channel></rss>