Presentation on theme: "Developing against Managed Meta Data – Blackbelt"— Presentation transcript:
1Developing against Managed Meta Data – Blackbelt Bart-Jan HoeijmakersDonald Hessing
2Introduction – Who are we? SharePoint Connections Autumn 2010Introduction – Who are we?Donald HessingWorking with SharePoint since 2007, before .Net architectTechnical Manager, Lead SharePoint Architect at VX CompanyVirtual Technology Solution Professional for Microsoft NetherlandsBart-Jan HoeijmakersWorking with SharePoint since 2006, before .Net developerLead SharePoint Developer at VX CompanyStrong focus on developing custom solutionsTODO PlaaUpdates will be available at
3Agenda Introduction – Who are We? Architectural overview of Managed Meta DataProvision Taxonomy FieldHow to set Taxonomy Field value programmatically?Query List items by Taxonomy Field value using CAMLSearch for items by TermColumn specific TermSets
5Managed Meta Data Service Application Sharing meta data cross:Sites, Site Collections, Web Applications, FarmsCentralized management of:TermSets, Terms, ContentTypesMMS can be connected cross farmMultiple MMS can be connected to thesame web applicationMMS is Tenant “aware” partitionedThe Managed Metadata Service application is, in my opinion, the most important new service application in SharePoint Server 2010. It’s responsible for enabling the centralized management of terms (also called metadata or tags) and deployment of content types across site collections, web applications, and even farms. Terms and content types are the backbone of information architecture (IA), so the fact that SharePoint 2010 now does these tasks, and does them well, is a big win!
6Terminology= TermStore= TermGroup= TermSet= Term= Term
7Administration Managed Meta Data Service Application AdministratorsManage the properties of the Service ApplicationsAre NOT Term Store Administrator by defaultPermissionsLocal Farm: By default all services local to the farm have full accessTerm Store AdministratorCreate Term GroupsAssign Term Group ManagersCan assign Term Group ContributorsCreate and manage Term Sets and TermsAlleen even rechten op de MMS aanstippen. Hier hoef je niks aan te doen
8Consuming Managed Meta Data Webapplication must be connected to the Service ApplicationManaged Meta Data Service Applications in the default proxy group are connected automatically
9Enterprise KeywordsEnterprise Keyword Field allows users to select enterprise keywords and managed termsUsed keywords are stored in the Keywords TermSet of the System Group in the MMSSet the default storage location for keywordsUsers must have permissions on the MMS
10Enterprise Keywords versus Keyword Keywords field is there for MOSS compatibilityKeywords words are not stored in the keywords termsetIf you have both fields added SharePoint will sync the valuesthe-keywords-field-vs.-the-enterprise-keywords-field-in-sharepoint.aspx
11TaxonomyHiddenListLocation: [SiteCollectionUrl]/Lists/TaxonomyHiddenListStores taxonomy values for:Assigned Taxonomy values in the site collectionDefault values of the Taxonomy Field Site ColumnThe Taxonomy Field is a lookup field to TaxonomyHiddenListThis prevents a hotspot on MMSTaxonomyHiddenList is synchronized with the TermStore by the Taxonomy Update Scheduler Timer JobUpdating a term in the TermStore doesn’t change the fieldThe new value is provided by the lookup to the synchronized TaxonomyHiddenList
13Provision Managed Metadata Field For provisioning a Taxonomy Field you need 2 Fields:<Field Type=“TaxonomyFieldTypeMulti” Name=“DemoTaxField” ..../><Field Type=“Note” Name=“DemoTaxFieldTaxHTField0” .... />TaxonomyFieldTypeMulti renders the hierarchical meta data field (FieldControl)Stores the WssId of the item in the TaxonomyHiddenList[4;#SharePoint 2010]Value is provided by the Lookup to the TaxonomyHiddenListNote field stores the selected term label and term GUID[SharePoint 2010|dd212d38-417e-4a9d-8222-e856b05d627b]The TaxonomyField stores the label defined when declaring the field. As the next sheet will show.
14Provision Taxonomy Field Microsoft Naming ConventionWhen provisioning TaxonomyFields, also provision the hidden notefield!ShowField is the field to be shown from the TaxonomyHiddenList. So the field defined here shows the English language label. If you deploy languagepacks, other languages will be available.
15Add Field to ContentType Manually add the TaxCatchAll and TaxCatchAllLabel fields to the listdefinition, or to your contenttypeSeach refinement panel and Document Information Panel rely on these fields
17Event ReceiversManually add the TaxonomyItemSynchronousAddedEventReceiver and TaxonomyItemUpdatingEventReceiver to the list definitionSynchronizes the TaxCatchAll fieldsand the hidden notefieldBij toevoegen van een TaxonomyField in de Userinterface worden deze eventreceivers automatisch aan de lijst toegevoegd.Ook als je een TaxonomyField vanuit code aan een lijst toevoegt, worden de eventreceivers automatisch gekoppeld.(Het hidden note field wordt dan overigens ook automatisch geprovisioned naar de lijst)
18Bind Taxonomy Field to TermStore Taxonomy Field is a specialized lookup fieldAfter provisioning it should be binded to a TermStore:Bind TermStoreID and TermSetID in event receiverBind the hidden note field in event receiverThis doesn’t work for SandBox solutions because the “Microsoft.SharePoint.Taxonomy” DLL is not available!!
20TaxonomyFieldAdded feature When using custom webtemplates, or site definitions based on Blank Site Template make sure that hidden feature 73ef14b1-13a9-416b-a9b5-ececa2b0604c (TaxonomyFieldAdded) is activated on the sitecollection!
23How to set a value of a Taxonomy field programmatically? In General: Terms that were not used before will be added to the TaxonomyHiddenList of the SiteCollectionTaxonomy Field can be updated byTermGUIDTerm from the Term Store (MMS)The Taxonomy Field has a reference to the TermStore (SspId) and TermSet (TermSetId)
24Set value by the Guid of the Term Site can have multiple TermStores associatedWe usually don’t know the GUID of the TermSetFieldValue methode is hier essentiele omdat indien je het via de propertie van de indexer doet er events niet afgaan (bv wssid aanmaken in taxhiddenlist)TODO: Check provision termset with predefined guids
25Set term based on LabelThe Taxonomy Field has a reference to the TermStore and TermSet Taxonomy FieldGet the Term by labelAsk someone what is “wrong” with this code
26demo Set taxonomy value TaxonomyHiddenList Verwijder Webparts list item uit taxonomylistVerwijder webparts uit taxonomyhiddenlist
27Query List items by taxonomy field value using caml
28Query the list using CAML Get all list items that are tagged with a term or one of its child termsCAML query can be constructed to achieve this goal<Where><In><FieldRef LookupId="TRUE" Name=“MyTaxonomyField" /><Values><Value Type="Integer">7</Value><Value Type="Integer">5</Value><Value Type="Integer">6</Value></Values></In></Where>TaxonomyField.GetWssIdsOfTerm(..,..,..)TODO::Fix images
29Taxonomy Fields and CAML Get the Lookup Id’s of the Term from the TaxonomyHiddenListConstruct the CAML queryExecute the CAML Query against the list
30Query List Items by Taxonomy Field value using CAML Demo
32Setting up Metadata properties For Taxonomy Fields, Crawled and Managed properties are automatically created after the first full crawlOnly when a list item is added and contains a taxonomy field valueNice for out of the box implementations, but for custom solutions :You can’t first call someone to create a listitem for the managed propertiesCreate the crawled and managed properties in advance by using powershellProvide crawled property with prefix ows_taxId_Provide managed property with prefix owstaxId
33Managed and crawled properties To create and map properties in PowerShell, use the following commandlets:New-SPEnterpriseSearchMetadataCrawledPropertyNew-SPEnterpriseSearchMetadataManagedPropertyNew-SPEnterpriseSearchMetadataMapping
35Hierarchical search vs exact search Prefix term GUID in search query with # or with #0#0 = exact search SharePoint# = search for the term or any child termsbelow it in the TermStore hierarchy SharePoint, MOSS 2007, SharePoint 2010TODO::aanpassen plaatje
36demo Searching items by term from code TODO::Aanpassen demo zodat de termset “netjes” opgehaald wordt. Code iets versimpelen
38Column specific TermSets In general Taxonomy Fields are connected to a central TermSetDepartmentsIt is also possible to create and connect to a local TermSetTo provide team specific termsets that don’t make sense for global availabilityTermsets are stored in the MMS with SiteCollection-FieldName as nameDefault storage location for column specific Term Sets should be enabledIn general Taxonomy Fields are connected to a central TermSet DepartmentsTo provide team specific termsets that don’t make sense for global availability Milestones
40Other Gotcha’ s TaxonomyHiddenList is resource throttled The TaxonomyHiddenList is not cleaned up with unused termsKeywords stored in the termstore are not security trimmedThe number of lookupFields is limited to 8 by default number of joins allowed per queryImport of termsets will get a new GUID during import | DTAP
41Key take aways!MMS can provide taxonomy for Sites, SiteCollections, Web Applications or FarmsTaxonomyHiddenList in the Site Collection prevents hotspot on MMSProvisioning Taxonomy Fields requires additional Fields and attached EventReceiversThe Taxonomy Field contains a reference to the TermStore and TermSetHierachical search on Taxonomy Fields can be done by using SearchUse #0 for exact matchUse # for search on child terms
42Q & A Contact Donald Hessing email@example.com ContactBart-Jan Hoeijmakers