move items to a new list? With attachments?

I see a few topics discussed on the subject however, most are not O365 and they have very unique situations that I don't have.


My situation is very simple, I have users submitting a form to a list with attachments.  After everything hs been completed and approved I will trigger a workflow to run.  This part I got.  In this workflow I want to move the item plus attacments to a new list for archiving purposes.


I already call the web service for the attachments in a nother workflow to email the user, however, I have not figured out how to move the item to a new list nor attach the attachments to an item.  I can create a new item and fill it with the data but there are over 100 columns that I would rather not hand pick, is there a way to easily move an item?  I can do a copy to new then a delete on the old, this works as well.

0 Kudos
1 Reply

Re: move items to a new list? With attachments?

In fact, you can move attachments with REST calls, it is the same as moving a document.

The trick is that attachments of items are stored not in the item but on the list directly.
Let say I have list named "TEST", here's the attachment for the Item 2, you will find a hidden folder at the root of your list named "Attachments" and a subfolder with the ID of your item

{ServerRelativeUrl}/Lists/{List name}/Attachments/{Item ID}/{File name}


If you move your file at this location, it will be considered as an attachement of the second item.
There also a second trick: You cannot use "copyTo" (from SharePoint API) directly to the destination folder if the folder does not exist beforehand. You need to create a dummy file (with content) to the the hidden folder location, then delete it. Otherwise your workflow will crash on the "copyTo" REST action.
There's also a 3rd trick: the size of your request cannot exceede 400 chars, but there's a workaround.

Please a look at this post : https://community.nintex.com/t5/Nintex-for-Office-365/Copy-task-attachments-to-Master-Item-on-O365/m...

0 Kudos