cancel
Showing results for 
Search instead for 
Did you mean: 
Workflow Hero

Copy document from Library to list item as attachment

Jump to solution

Good Day,

I have seen many users on the Community asking about copying documents from a Library to a list item and found many helpful answers but still cannot get this action to work. I have a custom solution in my SharePoint environment which receives a mail in a Library and then extracts xml data which is then used to 1. create a list item and 2. save all attachments to a designated document library, from here we have a workflow which kicks off for approval. what I need to do now is copy the documents from the designated document library and attach them to the list item, for this I am using the Call Web Service action with AddAttachment method in a separate Workflow that runs on the document library. the problem is that I keep getting an error:

Workflow Status

Failed to invoke web service. Error returned from server: <soap:Fault xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>soapSmiley Frustratederver</faultcode><faultstring>Exception of type 'Microsoft.SharePoint.SoapServer.SoapServerException' was thrown.


This is  my Call Web Service config

I have also found that if I make any changes to the text "<soap Envelope: xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:m="http://schemas.microsoft.com/sharepoint/soap/">" then the Workflow will not publish stating that SOAP envelope is not valid XML even when changing back to the original value unless I remove envelope/ from this section:
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/", which then gives me this error:

Workflow Details

Failed to invoke web service. Error returned from server: <soap:Fault xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><faultcode>soap:VersionMismatch</faultcode><faultstring>Possible SOAP version mismatch: Envelope namespace http://schemas.xmlsoap.

For reference I have also tried changing the m:attachment to <m:attachment>[FileData]</m:attachment> which has made no difference.

So what am I doing wrong here?

Labels: (2)
0 Kudos
Reply
2 Replies
Workflow Hero

Re: Copy document from Library to list item as attachment

Jump to solution

Okay, so after spending the entire day on the internet reading blogs, forums and online Q&A's I have found my problem!! and it's so simple I almost cried...
The ASMX resource file URL has to be in the following format: 'http://mywebapp/mysitecollection/_vti_bin/Lists.asmx', I had neglegted to add the Site Collection as i assumed that the resource file was located on the server, I'm quite new at this... but today i learned something I will not forget, EVER.  

Reply
Workflow Hero

Re: Copy document from Library to list item as attachment

Jump to solution

Hi Chantel Slabbert, I have been wrecking my brains and pulling my hair as i experienced the same issue you faced, however i found an alternative way to resolve it. Turns out i was setting the ID in a variable with the number data type, as you can imagine the endless testing and continuous errors. Thanks to Palesa Sikwane‌ the issue turned out to be the data type of the variable, changed it to Integer and that fixed the problem for me. Workflow runs like a charm.

Reply