Sp-dev-docs: Fetch term set id , when mapping it to userprofile property

Created on 9 May 2018  Ā·  7Comments  Ā·  Source: SharePoint/sp-dev-docs

I have a termstore where i have termsets example Department.
Now i have mapped this department to user profile property.
I am only able to fetch string i.e value but how can i fetch the guid of term set ?


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com āžŸ GitHub issue linking.

docs-comment answered question

Most helpful comment

I see. Yeah, I“m afraid there“s no other solution that set a "unique" name in the TermSet (at least I“m not aware of any other one)

All 7 comments

Pretty sure you can“t. Unfortunately, the Taxonomy fields are only stored as Plain Text in the User profile, so if you want the ID, you have to query the TermStore service by Name (which obviously is not great)

Yes, Even if i fetch it using Name , the problem is the term name is repeated
like
Department - Termset
Accounting - Termname
HR - subterm
Marketing - Termname
HR - subterm

So if i search for "HR" then it will result in two values which is another problem.

Is there any way of doing it using .Net CSOM ?

CSOM is not helping either, as the problem is that the value is always store as plain text by SP User profile service (in the past and on premises, I even remember to search it in the SQL DB, and there“s no GUID)
Anyway, Don“t you have the entire term name stored? i.e: "HR - SubTerm 1". If you do a search in the specific TermSet with that full name, you should get only one Term, right?

Thanks for quick reply @luismanez
the problem is that, the data is stored in such format :
image
Now assume that in user profile the value is stored as "HR", now in order to get the guid if i search in taxonomy (by name) , I will get two results.

So i guess one solution is to make name unique :

image

I see. Yeah, I“m afraid there“s no other solution that set a "unique" name in the TermSet (at least I“m not aware of any other one)

I know this is an old question but, is this affirmation (still) true?

Unfortunately, the Taxonomy fields are only stored as Plain Text in the User profile

If so, how is it possible that we can write a search query using, for example, the {User.SPS-Department.ID} or {User.SPS-Department.IDWithChildren} query variables? I can see in the QueryModification that the IDs are correct, even when the same label exists on different parents.

Was this page helpful?
0 / 5 - 0 ratings