Easy Way to Convert String to a URL Friendly String Using Microsoft Flow

Usually, when you convert the URLs from external sources, it comes with special characters . Let’s see how to convert String to a URL friendly string.

Well, this requirement came up for one of our Client that is a Marketing Agency based in Jacksonville, FL. They have a SharePoint list to save external URLs that is used by their team across the United States. Usually, when you convert the URLs from external sources, it comes with special characters like !@$#>% and couple of others. That’s when we found a way to convert such strings into a URL friendly string with the help of Microsoft Flow. Let’s see how this works:

Microsoft_Flow_Home_Screen

You can rely on the Replace function available in Microsoft Flow. This helps you to replace character by another one. In this scenario, we need to replace the special characters with a blank space. When this is done for each character at a time, you can nest them and you will get all the information in a single function.

Let’s create a Title dynamic property with the trigger of characters: [ ] ~ { } ^ ! , . % # * < > ? / ” @ & = / ; |) \

Copy the below code:

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(triggerBody()?['Title'],':',''),'%',''),'#',''),'*',''),'<',''),'>',''),'?',''),'/',''),'"',''),'"',''),'@',''),'&',''),'=',''),'/',''),';',''),'|',''),'\',''),'[',''),']',''),'~',''),'{',''),'}',''),'^',''),'!',''),',',''),'.',''

As you see below, a quick Flow can be setup for you to see the results. A 3-easy step procedure and we can get this done in minutes!

  1. When item is created
  2. Initialize Variable
  3. Update Item

Now create a Variable with Friendly URL and update item:

MS_Flow_Workflow_Screenshot

The variable values are the formula we had mentioned earlier, so make sure to update it with the actual string which you need it to be fixed. Copy pasting this will fix Title property of the trigger.

MS_Flow_Workflow_Screenshot_2

The output:

SharePoint_Office365_Group

The previous step didn’t actually help us remove the spaces. So, let’s try another code to remove the spaces too:

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(triggerBody()?['Title'],':',''),'%',''),'#',''),'*',''),'<',''),'>',''),'?',''),'/',''),'"',''),'"',''),'@',''),'&',''),'=',''),'/',''),';',''),'|',''),'\',''),'[',''),']',''),'~',''),'{',''),'}',''),'^',''),'!',''),',',''),'.',''),' ','')

Here's the output for the above query:

SharePoint_Office365_Group

Make sense? Awesome isn’t it? Give it a try and let us know your experience with Microsoft Flow and SharePoint!

Table of contents

Read more blogs

See all

SharePoint & Microsoft 365 (Product Tips & How-Tos)

Contract Management Strategy

Track Contracts: SharePoint Advanced Search and Filtering

Learn how SharePoint advanced search helps legal teams improve contract discovery, automate renewals, and enable secure AI-powered insights.

Read more

SharePoint & Microsoft 365 (Product Tips & How-Tos)

How To Add A Link To Your SharePoint Document Library

Did you know that SharePoint allows us to add links to document libraries, along with documents and files? Yes, that's right. Here is how to do that!

Read more

Contract Management Strategy

Elevate Your Sales Process With CMS-integrated Salesforce

Integrate Salesforce with Contract Management Software to upgrade your entire sales process and help your business grow.

Read more

Less time on contracts, complete control over them.

Automate contract tracking and renewals, connect every agreement to its vendors, invoices, and projects, and get full visibility with enterprise-grade security built in.

Our contract process didn't fit neatly into the rigid workflows offered by many vendors.

Dock 365 was the last vendor I looked at, but it quickly became clear it was the right fit

Jennifer McGaffey

Legal Operations Manager, Short Elliott Hendrickson