Forum Discussion

jecon's avatar
jecon
Copper Contributor
Apr 26, 2022
Solved

Mirror Between document libraries based off Choice Column

Hello everyone, Haven't been able to figure this out:   Scenario: 2 Sharepoint sites, Site1 - DocumentLibrary1 (Site with no guest access for document uploads) --- Site2 - DocumentLibrary2 (...
  • jecon's avatar
    Apr 27, 2022

    Update to this seeing as no one seems to know how to help:

     

    As there might be someone looking for this in the future I'll include the solution here.

    Good luck stranger, google is your friend!

     

    I resolved it myself with the following flow structure:

    • I needed to use the following expressions for the folder path in Copy File step:

    take(triggerOutputs()?['body/{Path}'],sub(length(triggerOutputs()?['body/{Path}']),1))

     

    • Made sure that the create folder step only runs if the folder is not present, and a join with a split function in the expression to take the file path without the root document library folder part and join it again:

    join(skip(split(triggerOutputs()?['body/{Path}'],'/'),1),'/')

     

    Then the copy file runs again and copies into the created folder.

     

    The issue with my trigger condition was that I included spaces once I removed them it worked perfectly:

    @equals(triggerBody()?['ExternalSharingDocuments']?['Value'],'Shared')

     

    Finally, I will create a separate delete flow for any "Shared" documents deleted in the source library to delete them in the document portal.

     

    Hope this helps someone.