SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've got a "Managed Metadata" column on a document library (required field). When I've added a document, I need to get te level of the selected term in my term store. I'm using a eventreceiver. I know how to get the value of the selected term, but not how to get the level...


  • TermSetName --> level 0
    -- Term1 --> level 1
    -- Term2 --> level 1
    --- Term2.1 --> level 2
    --- Term2.2 --> level 2
    --- Term2.3 --> level 2
    -- Term3 --> level 1

So when I select Term2.2, I want to get the level: 2
Anyone knows how to do this?

share|improve this question
Can you help how can you get the value of selected term, and set it in textfield. thanks, – Aissam Apr 4 '14 at 17:09
up vote 2 down vote accepted

If you have got hold of Term object, you can call its GetPath method to get a list of its ancestor separated by semi column(;). You can then split and find the index of last item in the split array. Check GetPath method here:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.