cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
simpim
Level: Powered On

502 BadGateway - Invalid URI when creating folder on SharePoint using subject line of incoming email

I have created a simple automated flow for certain incoming emails that creates a folder on SharePoint and uploads the body of the email and any attachments to said folder. The folder is named using the subject line of the incoming email.

 

Sometimes this flow fails at the create folder stage due to the following error message, "Invalid URI: The format of the URI could not be determined."

 

My initial thought was that this may be due to invalid characters in the subject line of the email. Is there a way to replace invalid characters with another character or any other workaround?

 

Manny

1 ACCEPTED SOLUTION

Accepted Solutions
Dual Super User
Dual Super User

Re: 502 BadGateway - Invalid URI when creating folder on SharePoint using subject line of incoming email

Hi @simpim 

 

use this expression to remove all special characters

 

replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(variables('artifactName'),':',''),'%',''),'#',''),'*',''),'<',''),'>',''),'?',''),'/',''),'"',''),'"',''),'@',''),'&',''),'=',''),'/',''),';',''),'|',''),'\',''),'[',''),']',''),'~',''),'{',''),'}',''),'^',''),'!',''),',',''),'.',''),' ','')
 
variables('artifactName') - can be updated with you email subject
 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

3 REPLIES 3
Dual Super User
Dual Super User

Re: 502 BadGateway - Invalid URI when creating folder on SharePoint using subject line of incoming email

Hi @simpim 

 

use this expression to remove all special characters

 

replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(variables('artifactName'),':',''),'%',''),'#',''),'*',''),'<',''),'>',''),'?',''),'/',''),'"',''),'"',''),'@',''),'&',''),'=',''),'/',''),';',''),'|',''),'\',''),'[',''),']',''),'~',''),'{',''),'}',''),'^',''),'!',''),',',''),'.',''),' ','')
 
variables('artifactName') - can be updated with you email subject
 

Regards,

Reza Dorrani

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly

View solution in original post

Highlighted
Community Support Team
Community Support Team

Re: 502 BadGateway - Invalid URI when creating folder on SharePoint using subject line of incoming email

Hi @simpim,

 

Have you solved your problem according to @RezaDorrani's suggestion?

 

If yes, you can mark Accept his reply as the solution to help the other members find it more quickly.

If no, could you share your folder name instance? If so we can assist you better.

simpim
Level: Powered On

Re: 502 BadGateway - Invalid URI when creating folder on SharePoint using subject line of incoming email

Yes, it works now!

Thank you

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 4 members 7,076 guests
Please welcome our newest community members: