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 / Replacing part of URL/...
Power Automate
Answered

Replacing part of URL/Path to redirect files; SharePoint

(0) ShareShare
ReportReport
Posted on by 62

Hello!, I'm hoping someone can help.

 

I'm trying to use "Replace" within an expression to replace a part of an URL to redirect files from SharePoint library to sharepoint library. I am certainly not a programmer so I have a lot of trouble understanding how to properly use expressions.

 

For a little more context why I want to achieve this. see my other post.

https://powerusers.microsoft.com/t5/Building-Flows/create-synchronized-specific-folders-within-Sharepoint/m-p/677061#M91241

 

22

 

 

 

Categories:
I have the same question (0)
  • v-alzhan-msft Profile Picture
    Microsoft Employee on at

    Hi @S_J_G ,

     

    What is the purpose to use the expression that you provided "replace(outputs('(I)_Get_files_(properties_only)_-_Internal_workspace')?['/teams/Zuidplaspolderfase5/06 Werkdocumenten}'],'/teams/Zuidplaspolderfase5/Actuele stukken omgeving','')"?

    What is the issue for the expression so the flow couldn't work? could you please share a screenshot of the flow run history?

     

    Best Regards,

    Alice

     

    Community Support Team _ Alice Zhang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • S_J_G Profile Picture
    62 on at

    Hallo @v-alzhan-msft,

     

    The purpose of the expression should be to archive the following;

    I am trying to copy files from one library to an other. But which folder/sub folder is variable, it depends on where the source file is located. but these folder structure is completely the same between the 2 librarys.

     

    https://Xonline.sharepoint.com/teams/project X/libraryone/folder 1/sub folder 1.1

    replace whit;

    https://Xonline.sharepoint.com/teams/project X/librarytwo/folder 1/sub folder 1.1

     

    Reading back the expression, it really doesn't make any sense to me 🤔

    I get the following error;

    3.PNG

     

     

     

     

     

     

     

  • S_J_G Profile Picture
    62 on at

    hi @v-alzhan-msft 

     

    I assume that I am so far off that it is no longer worth responding haha

    .but thanks anyways.

  • S_J_G Profile Picture
    62 on at

    hi @v-alzhan-msft 

     

    Why is my post solved? its not solved at all 😅

  • ChristianAbata Profile Picture
    8,953 Most Valuable Professional on at

    hi @S_J_G  just to understhand you are creating a varible with this value : Teams/Zudplasol...../Actuale.... so what is this friend?

     

    second you are using append variable this actions means that you are going to add some data to you initial variable like concatenate so why tou leave this empy?

    empty.PNG

  • S_J_G Profile Picture
    62 on at

    hi @ChristianAbata , ty for your reply!

     

    In the meantime I have taken a different direction. I don't think I need the "append to string" anymore, I maybe can put the output from "target path" in the action "create file" --> folderpad.

     

    i still cant get a proper replace action working. stil trying to do the following;

     

    https://Xonline.sharepoint.com/teams/project X/libraryone/folder 1/sub folder 1.1

    replace whit;

    https://Xonline.sharepoint.com/teams/project X/librarytwo/folder 1/sub folder 1.1

     

    I need to replace the red part with the green part. But the purple part is not static but needs to stay the same as source file.

    so i cant simpely use the a static URL in the Replace function. 
    I need to know the folder path for each source file then i need to be able to use the "folder path" in the replace fuction, i think.

    Or maybe first split the URL somehow, and append later on. 


    9.PNG

  • Verified answer
    ChristianAbata Profile Picture
    8,953 Most Valuable Professional on at

    hi @S_J_G  I hope this could guide you

     

    So first I asume you have the link to the library one, so what I did was just extract the word libraryone dynamically, so as you see in my first compose I have just the link then in the secod I get the lenght of my link thats because in substring I need that value.

    sol1.PNGsol2.PNG

    In the compose GetPosLibOne I just get the position of the word libraryone and then in the next compose I use the outputs of my previus compose's to get just the word libraryone using substring to finally use that word to replace it in the second link.

     

    This was my result

    lib.PNG

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 796

#2
Valantis Profile Picture

Valantis 671

#3
Haque Profile Picture

Haque 551

Last 30 days Overall leaderboard