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 / Best way to prevent fo...
Power Automate
Unanswered

Best way to prevent forbidden characters

(1) ShareShare
ReportReport
Posted on by 260

Hello

 

I have been trouble shooting occasional errors in my flow. The user enters text in a SharePoint field and a folder is generated after that. 

It had been giving me BadRequests, but a trim operation removed any trailing spaces and it worked great, until it the issue started again.

As it turns out there are also forbidden characters, (:, /, ...) being used.

 

I naturally think a replace operation could screen out the characters, but it would be a mess. Is there a more elegant solution?

 

Regards

Conn

Categories:
I have the same question (0)
  • Verified answer
    trice602 Profile Picture
    15,402 Super User 2025 Season 2 on at

    Hi @ConnM ,

     

    One thing that I have done is insert a compose and replace the illegal characters with an "_" or remove it completely.  Here's a sample replace expression to remove the most common characters:

    replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(test, '\\', ''), '/', ''), ':', ''), '*', ''), '?', ''), '"', ''), '<', ''), '>', ''), '|', ''), '&', ''), '#', '')

     

     

  • trice602 Profile Picture
    15,402 Super User 2025 Season 2 on at

    Note:  you would replace "test" above with your dynamic content.

     

     

  • ConnM Profile Picture
    260 on at

    Thanks @trice602 

     

    This is brilliant. I'll get this in ASAP

     

    Really appreciate it

    Conn

     

  • trice602 Profile Picture
    15,402 Super User 2025 Season 2 on at

    Hi @ConnM !  Nice!  Always glad to help and get this feedback on a Monday morning 🙂 

     

     

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 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard