copy files from a doc library (say test 1) to another (test 2) when user trying to upload or create document set in test 2


Badge +4

Hi,

I would like to copy files from a doc library (say test 1) to another (test 2) when user trying to upload or create document set in test 2 document library . Files from document lib Test 2 should be saved into document set of Test 1.

Anyone could help me please? Thanks


3 replies

Badge +9

Hi Swap,

Can you not set to Read permission the Test 2 Lib to avoid mistakes.

Regards,

Christophe

Badge +4

Thank you Christophe for your reply. I'll set to read permission the test 2 Lib, but I'm looking different solution.

Whenever user click on document set in Test 2 lib, workflow will import or copy all files from Test 1 lib.

Thanks.

Swap

Badge +4

Hi,

I've managed to resolve above issue by using below process.

1. Add Variables

76636_pastedImage_0.png76730_pastedImage_1.png

2. Add Regular expression

Pattern -  ^(.*[\/])

Operation - select Replace Text

Input Text - {Common:ContextItemUrl}

store result in - textDocSetRaw

3. Add Build String

Text - fn-Replace({WorkflowVariable:textDocSetRaw}, %20, )

store result in - textDocSetName

4. Add Build string

Text - fn-Replace({WorkflowVariable:textDocSetName},&OpenIn=browser,)

store result in - textDocSetName

5. Add Query list

Editor Mode - select Query builder

List - <source list name>

Select XML encode inserted Tokens

Field -

          Select Encoded Absolute URL - store in varSourceColl

          Select Name - store in varSourceFileName

76731_pastedImage_3.png

6. Add for each loop

Target collection - varSourceColl

Store result in - SourceURL

Index - CollIndex

7. Add Collection operation in loop

76732_pastedImage_4.png

8. set variable in loop

76733_pastedImage_5.png

9. Add Call web Service

76734_pastedImage_6.png

Workflow Snapshot

76736_pastedImage_8.png

76737_pastedImage_9.png

I hope this will help.

Thanks,

Swap

Reply