web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Get Term GUID from Ter...
Power Automate
Unanswered

Get Term GUID from TermStore in Sharepoint via REST API where name/label of term contains an ampersand

(1) ShareShare
ReportReport
Posted on by 56

We have a Term Set where we list all our partners and some of them have an ampersand (&) in their name and have a list with a Managed Metadata column using that Term Set.

 

When manually adding new entries to that list: no problem at all, but we also wanted to add items to that list via an automated way for bulk upload. In order to realize that, you need to know the GUID of the Term so that you can combine that with the label name of the Term set to add an item to the list.

  • Name|GUID

 

This is the URL we used to obtain the Term's GUID from the TermStore:

  • https://<your domain>/sites/contentTypeHub/_api/v2.1/termStore/groups/b7ffg3t7-29ec-47ad-9b8c-e10cc8a6d95e/sets/9e094eb0-2dec-4c41-bc97-b13f19d37456/terms?$filter=labels/any(c: c/name eq 'PlaceYourNameHere')

 

So far so good, until you hit a name with an ampersand in it, like e.g. 'Apples & Bananas'.

 

Being 2023, one would expect that Power Automate would do a proper conversion/encoding of special characters, but that's not the case (still stunned, after > 30 years in the ICT-business that these special characters continuously need special handling everywhere and that pretty much everybody always need to take this into account when creating flows, interfaces,....  but that's another discussion 😉 )

 

Anyway, did a whole lot of research and testing with different combinations:

  • +encodeURIComponent('Apples & Bananas')
  • Apples%20%26%20Bananas
  • Apples_x0020__xFF06__x0020_Bananas (as apparently the & is encoded in a special way: 
  • ....

 

Spent several hours on it this morning, but all to no avail 😠

 

So I fetched the entire list and pasted it into Notepad++ and noticed that the ampersand looked 'quirky':

 

KrAck_0-1694782399052.png

 

Completely different from a manually entered ampersand:

KrAck_1-1694782518543.png

 

And also in Power Automate this is shown 'differently':

KrAck_0-1694784205890.png

 

 

Looked at that character in a Hex Editor (XVI32):

KrAck_3-1694782778498.png

 

And that's the 'FULLWIDTH AMPERSAND':

 

So I did a replace function to replace the 'normal' ampersand in this case with this special one by doing some copy & pasting in Notepad++ and afterwards copied it into Power Automate.

  • replace(items('Apply_to_each_Contract')?['Partner'],'&','&')

 

And guess what?

 

I'm able now to find the GUID of a term by label name and use the name and GUID combination to add new items to my list, but it took me the better part of an entire day to figure this out 😩

 

But would like to know if there's somebody out there having similar experiences with this and if there are (hopefully) better ways to achieve this?

 

Most useful sources I consulted from the several dozen ones I consulted during my quest

 

 

 

 

 

 

 

Categories:
I have the same question (0)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard