TeeVee
Nintex Newbie

Copy attachment from a list item to another list item using SharePoint REST API

I am having trouble using SharePoint's REST API to copy attachments from one list item to another list item in a different site collection. Can someone please help?

 

Using REST, I am able to generate the attachment, but it's contents are blank

 

I used a Web Request to get the contents of the attachment:

https://<site>/_api/web/getfilebyserverrelativeurl('<relativeURL>')/$value?binaryStringResponseBody=true

 

2019-10-25 16_49_04-Workflow Designer - Internet Explorer.png

 

I then used another Web Request to add the attachment to desired list item:

https://<site>/_api/web/lists/GetByTitle('')/items({WorkflowVariable:itemID})/AttachmentFiles/add(FileName='<filename>')

 

2019-10-25 16_43_03-Workflow Designer - Internet Explorer.png

 

However, the attachment is blank 😞

 

I know there have been previous topics that have touched on how to do this, but I am just not able to piece together the bits to get it working.

 

Some of the posts and blogs I have been looking at include:

 

Fetching an Adding an attachment using Call Web Service action

https://community.nintex.com/t5/Nintex-for-SharePoint/Fetching-an-Adding-an-attachment-using-Call-We...

 

How to execute a SP2013 REST API request with Nintex Workflow

https://community.nintex.com/t5/Community-Blogs/How-to-execute-a-SP2013-REST-API-request-with-Nintex...

 

Thanks in advance 🙂

0 Kudos
Reply