Extract the Term Sets and their custom properties using CSOM in SharePoint 2013


The code snippet below will help you to query the SharePoint 2013 Term store using CSOM (ECMAScript):

//Get the Current SP Context

var context = SP.ClientContext.get_current();

 

//Get the Current SP Taxonomy Session
var taxSession = SP.Taxonomy.TaxonomySession.getTaxonomySession(context);

 

//Get the Term Stores instance
var termStores = taxSession.get_termStores();

 

//Get the exact Term Store you would like to query

//To get this…goto your term store, inspect the HTML element corresponding to your Term Store in your

//browser and you will get this ID

//Check the screenshots below
var termStore = termStores.getByName(“Taxonomy_foSyfMpI/9yqdQsdxwuVGA==”);

 

//Get the required Term Set you want to fetch

//To get this…goto your term store, inspect the HTML element corresponding to the Term in your browser and check the ID of the <li> element
var termSet = termStore.getTermSet(“8ed8c9ea-7052-4c1d-a4d7-b9c10bffea6f”);

 

//Load the termSet into the context
context.load(termSet);

 

//Execute the Query
context.executeQueryAsync(function(sender,args){
//Contains the Terms and their custom properties

//Check the screenshot below 
},function(sender,args){

//Any exception messages

console.log(args.get_message());

});

Screenshots:

Image

Fig: Extracting the TermStore ID

Image

Fig: Extracting the Term ID

Image

Fig: Execution the above script in chrome browser Developer Toolbar Javascript Console (F12)

Image

Fig: The execution results showing the Custom Property key and value

For further reference on extracting the terms, termsets and groups refer here:

http://cann0nf0dder.wordpress.com/2013/04/09/accessing-taxonomy-term-store-with-jsom/

Hope this helps.

10 thoughts on “Extract the Term Sets and their custom properties using CSOM in SharePoint 2013

  1. The number also depends on whether the game is big or small.
    These banks are often smaller than their competitors and focused
    on a specific geographic niche. A neat addition to FIFA 11 is the
    ability to upload your own recorded audio for use in the game.

  2. The amount of free time you have may be limited, but you should still spend it doing what you enjoy.

    The qualifying games for every FIFA World Cup go on all around the world for
    3 years preceding the main tournament. Customers are loving these changes; have you hugged your
    HDTV now.

  3. The bottom line: The PX5 is easily one of the best wireless
    surround sound game playing headsets we’ve ever tested.
    See Our site for more details on Fountain Blue Hotel Miami Beach and
    Fountain Blue Hotel Miami Beach. The company also exceeds industry standards by inspecting areas and conducting procedures that many inspectors do not.

  4. I was recommended this website by my cousin. I’m not sure whether this post
    is written by him as no one else know such detailed about my problem.
    You’re wonderful! Thanks!

  5. But beware; once you come for a visit, you may never want to
    leave. Also, different types of rooms and cheap room rates is offered to lure
    the customers and there nothing hidden from the customer, and
    they can get services and facilities as per their needs.

    Prominent Points making Singapore a growing business hub:-.

  6. It is really up to each person and the hours they decide they want to work.
    s not that you will always attain success, many a times you may fail
    but you should keep yourself going and in the end you
    surely will be benefitted by it. For example, if your business is into plants,
    then you can have a Venus fly trap design for your folded business card.

  7. Sjoukje ZaalHi Laura,Thanks for your comment. I am very crouius about the adoption of this new app model and if there indeed will be a lot of developers (who are using other programming languages then .Net) are going to create apps for SharePoint 2013. I know I’m definitely going to write some Apps in the near future .

Feel free to leave a reply here...

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s