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.

  1. Wow! After all I got a blog from where I be able to in fact take helpful facts regarding my study and knowledge.

    Reply

  2. 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.

    Reply

  3. 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.

    Reply

  4. 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.

    Reply

  5. 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!

    Reply

  6. 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:-.

    Reply

  7. 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.

    Reply

  8. Greetings from Carolina! I’m bored at work so I decided to browse your
    website on my iphone during lunch break. I really like the
    knowledge you provide here and can’t wait to take a look when
    I get home. I’m shocked at how fast your blog loaded on my mobile ..
    I’m not even using WIFI, just 3G .. Anyways, great blog!

    Reply

  9. Hi,
    This is very helpful post. In the above article i could not see , how to get Custom properties, can you please send me whole script file with code for getting custom properties.

    Regards,
    Imran

    Reply

  10. 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 .

    Reply

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 )

Connecting to %s

%d bloggers like this: