cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
m_k
Nintex Newbie

How to Copy files from one site collection document library to another collection multiple sites document libraries?

Jump to solution

Hi Everyone,

I've been trying everything to make this work, but failing miserably and could really use any direction from you guys please!

The facts:

- I have a folder on site in one site collection

- This folder has multiple spreadsheets

- Every month, these spreadsheets get updated

- Each spreadsheet should then be Copied into its relative site which reside in a different site collection

What I would like the Site workflow to do:

- Run every month

- Copy all spreadsheets

- Paste the right spreadsheet in its relative site's document library

This is the 1st portion of my Site workflow where I Query the document library and get the Spreadsheet names, URLs and GUID all stored in Collection VARs. Then using the For each.

At this point, I literally have everything I need and just want to copy the right file to right Site.

To determine which Site the File should be copied into, I'm using the Switch where each FileName is exactly equal to the spreadsheet name in the Source Folder:

To get the Destination URLs, I plan to Build a String under every Switch Branch and store each Destination URL into a string VAR and Set Variable where FileURL = Destination URL.

Finally (and this is the part I'm having major trouble with) comes the Copy Items using Call Web Service: This is what it looks like

And this is the error I get:

What am I missing?

Labels: (1)
0 Kudos
Reply
6 Replies
Nintex Employee
Nintex Employee

Re: How to Copy files from one site collection document library to another collection multiple sites document libraries?

Jump to solution

Hello M K‌ - 

You can do this and you are on the right track.

I created a site workflow on the Source site and am using the following workflow variables within:

Keeping with your approach, you really only need to query the Encoded Absolute URL of the item along with the Name (to get the file name for later). So using the good 'ol Share Documents Library for an example, it would look like this:

I placed one test excel file there and when I Run Now, I see this:

Keep in mind, you'll have a Collection of items, not just a single file.

Next, you simply need use a For Each loop to loop through your collection of items to separate them out one at a time. Something like this:

For Each:

At this point, we have the Source URL for our web service call. Now we need to build the URL for Destination.

First we need to get the file name and extension. We can do this by extraction the file name from our other collection:

Collection Operation:

Here is where you want to add your logic of the switch to determine where it will land. After you determine that piece of it, simple use a Set Variable action to set the var_DestinationURL. It will look something like this:

http://DestinationSiteCollection/DestinationLibrary/var_FileName

We now have all the pieces to push the item over to your destination. We can call the web service that you have, CopyIntoItemsLocal. Here is how it would look with the variables in place:

Once you run the web service, increment the index by one and let the loop handle the next one!

You can add in Log to history actions through out the workflow to check the URLs to ensure they are accurate, and I would recommend doing that so you do not republish and rerun multiple times!

Hope this helps!

Reply
m_k
Nintex Newbie

Re: How to Copy files from one site collection document library to another collection multiple sites document libraries?

Jump to solution

Thank you very much Jesse – This helped a lot ☺

Reply
Nintex Employee
Nintex Employee

Re: How to Copy files from one site collection document library to another collection multiple sites document libraries?

Jump to solution

Always happy to help! Glad you got it working!

0 Kudos
Reply
yoav_rappaport
Nintex Newbie

Re: How to Copy files from one site collection document library to another collection multiple sites document libraries?

Jump to solution

This is something i'm trying to get done in O365. Do you know what the equivalent actions for the Query list is. I can't seem to find the right process to get the URL and the name into the two collection variables. Thanks!

0 Kudos
Reply
gls_insight
Nintex Newbie

Re: How to Copy files from one site collection document library to another collection multiple sites document libraries?

Jump to solution

Hi Yoav, you can still use Query list in Nintex Office 365 for bulk uploading/editing but what I used to copy the current document was the Office 365 Upload File action.

0 Kudos
Reply
bjacharya
Nintex Newbie

Re: How to Copy files from one site collection document library to another collection multiple sites

Jump to solution
Can I create List Workflow instead of Site Workflow. My purpose is whenever user upload a document to a DL it should be copied to another DL in different SC.
0 Kudos
Reply