cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
S_J_G
Helper II
Helper II

Replacing part of URL/Path to redirect files; SharePoint

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-Share...

 

22

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

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



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA

View solution in original post

7 REPLIES 7
v-alzhan-msft
Community Support
Community Support

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.

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

 

 

 

 

 

 

 

hi @v-alzhan-msft 

 

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

.but thanks anyways.

hi @v-alzhan-msft 

 

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

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



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA

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

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



Did I answer your question? Please consider to Mark
my post as a solution! to guide others :winking_face:

Proud to be a Flownaut!


If you want you can follow me at www.christianabata.com Quieres contenido en español? Síguenos en Power Automate LA

View solution in original post

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,457)