Taxonomy Based Content Targeting for a Share Point
Taxonomy Based Content Targeting for a Share. Point Internet Site Gary Lapointe Director, Aptillon, Inc. Share. Point MVP
About Me • Aptillon, Inc. – Director and Founding Partner – http: //www. aptillon. com • Share. Point MVP since January 2008 • Blog: http: //blog. falchionconsulting. com • Twitter: @glapointe
Agenda • Case Study: Visio Marketing Site • Managed Term Store and Taxonomy Fields • Customizing the Content By Query Web Part
Visio Marketing Site
Goals • Divide and serve content via multiple user dimensions, content sections and categories • Improve content structure with an expansive ability for content reuse • Separation of content from structure allowing for easier user interface updates and redesigns in the future
Article & Section Pages Related Articles: Editing Section Tags: Custom CQWP Tags are articles stored inwith a showing Taxonomy. Field exposed more tagsin viaone the or Page Layout matching this page’s edit mode. tags. Filter By: Custom Tags: Custom Web CQWP showing Part showing terms associated with the current page. section page. Editing Tags: Tags are stored in a Taxonomy. Field exposed via the Page Layout in edit mode. Articles: Custom CQWP with results filtered by Taxonomy. Field value and a query string value.
demo VISIO MARKETING SITE
Managed Term Store and Taxonomy Fields • • Managed Metadata Overview Taxonomy API Taxonomy Field Values Taxonomy Field Properties
Managed Metadata Overview • Service Application (Term Store) – Can associate more than one with a Web Application • Group – Collection of Term Sets • Term Set – Collection of Terms • Terms – Word or phrase used to tag data • Term Scopes – Global (scoped to Service Application) – Local (scoped to Site Collection)
Taxonomy API • Taxonomy. Session – Sets the context for the given SPSite object • Term. Store – Retrieves the collection of Term Stores (1/Associated Service Application) – Stores a collection of Group objects • Group : Taxonomy. Item – Accessed via Term. Store. Groups property – Stores a collection of Term. Set objects • Term. Set : Term. Set. Item : Taxonomy. Item – Accessed via the Group. Term. Sets property – Stores a collection of Term objects • Term : Term. Set. Item : Taxonomy. Item – Accessed via the Term. Set. Terms property – Represents the actual label – Alternate labels accessible via the Labels property
Taxonomy Field Values • Field Type (class name): Taxonomy. Field • Taxonomy. Field. Value. Collection (when allowing multiple terms) or Taxonomy. Field. Value • Represented as a string: – <Term Label>|<Term ID>; • Value also stored in hidden Text field – <Original Internal Name>Tax. HTField# • Internal field name length <= 32 – Same value but as a string • All values stored in lookup list for performance and security reasons
Taxonomy. Hidden. List • ~site/Lists/Taxonomy. Hidd en. List/ • Only used items are stored • Deleting from this list will effectively clear from items using the tag
Taxonomy Field Properties • Ssp. Id – Corresponds to the Term Store var field = new Taxonomy. Field(web. Fields, "Taxonomy. Field. Type. Multi", "Field. Name"); web. Fields. Add(field); field = (Taxonomy. Field)web. Fields. Get. Field. By. Internal. Name("Field. Name"); field. Allow. Multiple. Values = true; field. Ssp. Id = term. Store. Id; field. Term. Set. Id = term. Set. Id; field. Anchor. Id = anchor. Id; field. Title = "Field Title"; field. Update(); • Term. Set. Id – Term Set containing all the Terms for the field • Anchor. Id – The root Term. Set. Item • Allow. Multiple. Values – True: Field type is Taxonomy. Field. Type. Multi – False: Field type is Taxonomy. Field. Type
demo MANAGED TERM STORE AND TAXONOMY FIELDS
Customizing the CQWP • Why Customize the CQWP? • Manipulating CQWP Data
Why Customize The CQWP? • Can’t handle Multi-choice Taxonomy Fields when not scoped to a List – These fields must be added programmatically – Common. View. Fields, Data. Mappings , Data. Mapping. View. Fields, etc. , does not work when trying to retrieve field values • Taxonomy. Field filter values must be a GUID – Makes testing difficult – Can impact SEO – Can impact deployment/migration scenarios • Needed additional information for many result sets – Calculated information such as ratings is required for sorting • All the power of the CQWP without any of the browserbased customizations
Manipulating CQWP Data. Row: base. Filter. Field 1 = "<field name>"; ~site/Pages/Article 1. aspx base. Filter. Type 1 = "Taxonomy. Field. Type. Multi"; • Title base. Filter. Value 1 = filter; On. Load(Event. Args e) { protected override void • Summary base. On. Load(e); base. Process. Data. Delegate = • Thumbnail this. Process. Data. Delegate = new Process. Data(Process. Items); • Article. Tags } string filter = Http. Context. Current. Request. Query. String["Filter 1"]; • Ratings Taxonomy. Session ts = new Taxonomy. Session(Context. Current. Site); protected virtual Data. Table Process. Items(Data. Table dt) { Term. Collection terms = ts. Get. Terms(filter, true, String. Match. Option. Exact. Match, 1, Data. Row: true); //TODO: Process items ~site/Pages/Article 2. aspx } • Title if (terms. Count > 0) { • Summary filter += Taxonomy. Field. Taxonomy. Guid. Label. Delimiter + terms[0]. Id. To. String(); } • Thumbnail • • Article. Tags Ratings
demo CUSTOMIZING THE CONTENT BY QUERY WEB PART
Summary • Terms aren’t just for Intranets! • Using Terms to “tag” content can provide lots of benefits • The CQWP is extremely powerful and can easily be extended to add power and versatility • Watch out for migration and deployment issues!
About Aptillon • Share. Point MVPs • Microsoft Certified Master • Consultants, Trainers, Authors, Speakers, Bloggers • Great People, Great Experience, Great Passion Todd Baginski David Mann Gary Lapointe Darrin Bishop Maurice Prather Dan Holme. Matthew Mc. Dermott
Questions?
- Slides: 21