SharePoint ECM - Internals of Metadata Management - I

SharePoint 2010 has introduced many new functionalities which has changed and improved ECM dramatically. This different components that fall under the ECM label like WCM(Web content management), document management, records management and functionalities like eDiscovery (finding content), auditing, and setting up holds for content involved in litigation, Meta data (Taxonomy and folksonomy) to categorize the document. This blog talks about the metadata management. Taxonomies are hierarchical sets
of terms, or tags, usually centrally defined. Folksonomies are similar to taxonomies in that they are a collection of terms, but they have no organization or hierarchical structure. Metadata is used in many more places throughout SharePoint, such as refining search results, filtering and navigating content within SharePoint lists and document libraries using the new Metadata Navigation Settings list, and enabling users to tag pages in social solutions. Recently I have worked on engagement and have gotten chance to work on Metadata API programming where I want to share. Before we dive in to internals of Metadata management, we need to know the following terms.

 

  • Terms - A term is the central object in the taxonomy system.
  • Termset - A collection of  related terms in a hierarchy is a termset.
  • Labels - Terms have to be  known by a bunch of different names.
  • Groups - Groups in the  taxonomy system are simply collections of termsets that share a common security assignment.
  • Keywords - Free hand strings(folksonomy) is a simply flat list of strings.
  • Open Termsets - Open termset allow content editors to add new terms to a hierarchy at content authoring time.
  • Closed Termsets - Open termsets does not allow content editors to add new terms to a hierarchy at content authoring time.
  • Default Label - The label used for the term set when it is selected and displayed in the user  interface.
  • Description - A brief description of what the term is used for.
  • Available for Tagging - A flag indicating if the term can be used to tag content.
  • Language - Each term can be  translated to multiple languages (depending on the language packs  installed in the SharePoint farm).
  • Synonyms Some terms may be different depending on  the users and the context.

 

Programming:

 SPS2010 includes a robust application programming interface (API) that developers can use to create and manage taxonomies. The API is found in the Microsoft.SharePoint.Taxonomy.dll assembly. You will find this reference in C:\\Program Files\\Common
Files\\Microsoft Shared\\Web ServerExtensions\\14\\ISAPI\\Microsoft.SharePoint.Taxonomy.dll. This has the following namespaces which we have to know while programming

 

  • Microsoft.SharePoint.Taxonomy.TaxonomySession
        
  • Microsoft.SharePoint.Taxonomy.TermStore    
  • Microsoft.SharePoint.Taxonomy.Group    
  • Microsoft.SharePoint.Taxonomy.TermSet
        
  • Microsoft.SharePoint.Taxonomy.Term
        

 

Inorder to program "Term", we have to fetch the Session, refer the TermStore, get the Group & TermSet and code on Term object which is in the above order. 

 TaxonomySession session = new TaxonomySession(SPContext.Current.Site);

TermStores termStore = null;

            if (this.session.TermStores.Count!= 0)

            {

                this.termStore = this.session.TermStores["Test"];

                this.group = this.termStore.Groups.GetByName("TestGroup");

                TermSet termSet = this.group.TermSets[termSet];

                Term term = termSet.Terms[<<Guid>>];

            }

 

We will see more in the following post. Thanks.

 

Happy coding...