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

Announcements

News and Announcements icon
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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 1,027

#2
Valantis Profile Picture

Valantis 809

#3
Haque Profile Picture

Haque 645

Last 30 days Overall leaderboard