Hi,
I'm also trying to copy an attachment from an item in one list (List 1) to an item in another list (List 2). I've looked at both of the suggestions in Peter D's post (the MSDN site and post 8036 on Nintex Connect), amongst other posts. In the 8036 post a file is copied from a Document Library to a list attachment using this SOAP:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<AddAttachment xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<listName>CAS-06699-LRR5</listName>
<listItemID>1</listItemID>
<fileName>{ItemProperty:FileLeafRef}</fileName>
<attachment>[FileData]</attachment>
</AddAttachment>
</soap:Body>
</soap:Envelope>
Where {ItemProperty:FileLeafRef} is the document name inserted reference and [FileData] is the file byte array parameter.
The SOAP that I am using for my workflow is:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<AddAttachment xmlns="http://schemas.microsoft.com/sharepoint/soap/">
<listName>SW App Approval Log</listName>
<listItemID>{WorkflowVariable:lLogItemID}</listItemID>
<fileName>{ItemProperty:FileLeafRef}</fileName>
<attachment>[FileData]</attachment>
</AddAttachment>
</soap:Body>
</soap:Envelope>
The error I get is "Failed to invoke web service. Object reference not set to an instance of an
object."
My assumptions is that I have two problems. Specifically, {ItemProperty:FileLeafRef} is probably not valid for the filename of an attachment, and [FileData] is not valid for containing the data associated with the attached file.
To solve the first problem, I'm using an example from post 7612 to get an attachment collection for this item from which I get the filename, but I'm stumped on what to do about the file byte array parameter [FileData].
Thanks,
Neal