cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Regular Visitor

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
Highlighted
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

4 REPLIES 4
Highlighted
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
Community Support

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.

Regular Visitor

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

Yes, it works now!

Thank you
Highlighted
Frequent Visitor

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

Thanks Reza for you contribution to the Power Platform. 

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Top Kudoed Authors
Users online (14,165)