Showing posts with label managed metadata. Show all posts
Showing posts with label managed metadata. Show all posts

Sunday, April 22, 2018

Sneak peek at managed navigation for HUB sites

A granite mountain peak rising up above pink-hued clouds
Photo by Cédric Servay at Unsplash

One of the cool features of the new hub sites is that associated sites inherit the navigation of the hub. This means you have one place to configure navigation, and you don’t have to resort to any of the numerous custom solutions out there to solve this. Hub sites makes it very easy to create small hierarchies of sites with a common navigation structure.

A lesser known fact is that the hub navigation also support managed navigation, a popular way to configure navigation since its inception in SharePoint 2013, and something constantly asked for in modern sites.

This post will show that you can achieve it today, but you should probably wait until it’s properly supported.

Monday, July 10, 2017

Querying managed metadata using REST (unsupported)

I’m working with a set of SharePoint framework web parts and finally got fed up of using JSOM to work with managed metadata. Referencing JSOM feels wrong for so many reasons in this modern day and age, so I’d rather not do it.

I mean, when the out-of-the-box modern controls in SharePoint can work with terms using REST, why shouldn’t I? I like to believe I’m pretty modern.

image

After Fiddling the modern UI I found out that all taxonomy requests are working against a service at /_vti_bin/TaxonomyInternalService.json. This is a good old service, also listed on MSDN at https://msdn.microsoft.com/EN-US/library/microsoft.sharepoint.taxonomy.webservices.taxonomyinternalservice_methods.aspx. It is indeed marked for internal use, and until we get a new public REST point, everything points to that it should indeed work. If not, why would Microsoft use it themselves?

I have put together a sample SPFx web part based on the MSDN documentation, trial and error, showcasing different methods I found useful when retrieving terms. It’s by no means complete, but should help you get started.

You can find the sample at https://github.com/wobba/spfx4fun/tree/master/react-taxonomy-rest (link to all methods)

Samples include:

  • List term stores
  • List term groups in a term store
  • List term sets in a term group
  • Search for term by label
  • Search for term sets by name of term set or term in set
  • Get level one terms of a term set
  • Get child terms for a term

Using these calls you should have enough information to build a metadata driven megamenu, or build a taxonomy picker.

I have included interfaces for all the REST calls with some comments, but not for the returned results. You might have to examine the result JSON and pick out what you need.

And as a nugget I output the JSON with indentation, a tip I picked up from Sahil Malik :)

Sample interface

interface IGetSuggestionsRequest {
  start: string; // query
  lcid: number;
  sspList: string; // guid of term store
  termSetList: string; // guid of term set
  anchorId: string;
  isSpanTermStores: boolean; // search in all termstores
  isSpanTermSets: boolean;
  isIncludeUnavailable: boolean;
  isIncludeDeprecated: boolean;
  isAddTerms: boolean;
  isIncludePathData: boolean;
  excludeKeyword: boolean;
  excludedTermset: string;
}

Wednesday, April 27, 2016

Gotcha when administrating multiple MMS’ in SharePoint

image

If you create more than one managed metadata service in SharePoint and want to enter one of them via Central Admin, make sure BOTH are checked off as available services for the Central Admin web application. If only one is selected, then clicking either MMS will take you to the one assigned to the web application.

Tuesday, February 5, 2013

Importing terms with Ampersand (&) to Managed Metadata

When working on populating the term store in SharePoint 2013 with some data from a CSV file via PowerShell I encountered a weird issue with ampersands.

Importing works just fine, but when running the script the second time where it should not create nodes already existing, it still tried to re-add all terms with an ampersand in them.

Reading the post SharePoint 2010 Managed Metadata Import Ampersand by David Winchurch explains that ampersands are getting unicode encoded during import, hence comparison with the non-unicode version will fail.

Fortunately there is a helper method TaxonomyItem.NormalizeName which will trim consecutive spaces to one as well as encode ampersands, and it works equally well in 2013 as in 2010.

You gotta love all the special quirks in SharePoint Open-mouthed smile