Wednesday, September 25, 2013

“The search service is not able to connect to the machine that hosts the administration component. Verify that the administration component 'GUID' in search application 'Search_ Service_ Application ' is in a good state and try again”

Issue: SharePoint Search not working.


Uls Log Error: Class not registered (source Microsoft OLE DB Service Components, 0x80040154, code 0: Class not registered  )  [atldbext.cxx:1386]  d:\office\source\search\libs\utild\atldbext.cxx
CAppConfig::DoQuery, Application 'bbf8b00c-3c3a-41fa-9225-a3b81385d309', Resource '2': m_pParent->CreateSession failed.  [resourcemanagerimpl.cpp:1438]  d:\office\source\search\native\mssrch\resourcemanagerimpl.cpp

Resolution: Uninstall and Install SQL Native Client.

Download Link: http://www.novixys.com/ExultSQLServer/sqlncli.html


Thursday, September 19, 2013

List out the full tree in taxonomy term store into a TreeView (Dynamically)

Get the Taxonomy structure into a Asp.Net TreeView


Enjoy ;)

protected void  Page_Load(object  sender, EventArgs  e)
        {
            SPSite  thisSite = SPContext .Current.Site;
            TaxonomySession  session = new  TaxonomySession (thisSite);
            TreeNode  treeNode = new  TreeNode ();
            treeNode.Text = "Root" ;
            tvMetadataTree.Nodes.Add(treeNode);
            int indexTermStoreCount = 0;
            foreach (TermStore termStore in session.TermStores)
            {
                var tsNode = new TreeNode(termStore.Name, indexTermStoreCount.ToString(), null, "", null); 
                treeNode.ChildNodes.Add(tsNode);

                foreach (Group group in termStore.Groups)
                {
                    if (!group.IsSiteCollectionGroup)
                    {
                        TreeNode node = new TreeNode(group.Name, null, null, "", null);
                        tvMetadataTree.Nodes[0].ChildNodes[Convert.ToInt16(indexTermStoreCount)].ChildNodes.Add(node);
                        int indexGroupCount = 0;

                        foreach (TermSet termSet in group.TermSets)
                        {
                            TreeNode ts = new TreeNode(termSet.Name, indexGroupCount.ToString(), null, "", null);
                            tvMetadataTree.Nodes[0].ChildNodes[Convert.ToInt16(indexTermStoreCount)].ChildNodes[Convert.ToInt16(indexGroupCount)].ChildNodes.Add(ts);
                            ts.Selected = true;

                            foreach (Term term in termSet.Terms) 
                            {
                                AddTermSet(term, ts); 
                            } 
                        }

                        indexGroupCount++;

                    }
                }

                indexTermStoreCount++;
            }
        }


        protected void AddTermSet(Term term, TreeNode treeNode)
         {
            TreeNode childNode = new TreeNode(term.Name, null, null, "", null);
            treeNode.ChildNodes.Add(childNode);
            
            foreach (Term t in term.Terms)
            {
                AddTermSet(t, childNode);
            }
         }