Skip to main content

Notifications

Community site session details

Community site session details

Session Id : 3vfo/NAnzsQeG3zRfD5nF9
Power Automate - Building Flows
Answered

Replacing part of URL/Path to redirect files; SharePoint

Like (0) ShareShare
ReportReport
Posted on 7 Sep 2020 18:54:50 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

 

 

 

  • Verified answer
    ChristianAbata Profile Picture
    8,947 Most Valuable Professional on 16 Sep 2020 at 18:33:37
    Re: Replacing part of URL/Path to redirect files; SharePoint

    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

  • S_J_G Profile Picture
    62 on 16 Sep 2020 at 05:48:56
    Re: Replacing part of URL/Path to redirect files; SharePoint

    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

  • ChristianAbata Profile Picture
    8,947 Most Valuable Professional on 15 Sep 2020 at 15:38:32
    Re: Replacing part of URL/Path to redirect files; SharePoint

    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 14 Sep 2020 at 06:56:06
    Re: Replacing part of URL/Path to redirect files; SharePoint

    hi @v-alzhan-msft 

     

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

  • S_J_G Profile Picture
    62 on 11 Sep 2020 at 06:25:18
    Re: Replacing part of URL/Path to redirect files; SharePoint

    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 09 Sep 2020 at 06:22:14
    Re: Replacing part of URL/Path to redirect files; SharePoint

    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

     

     

     

     

     

     

     

  • v-alzhan-msft Profile Picture
    on 09 Sep 2020 at 02:05:20
    Re: Replacing part of URL/Path to redirect files; SharePoint

    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.

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,645 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard