Not applicable

Is it possible to use AddAttachment web service in Workflow Tasks?

I am trying to use the AddAttachment web service in Workflow Tasks list but it is not working. I even hardcoded it for testing. See below:

 

<?xml version="1.0" encoding="utf-8"?>

<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/">

  <soap:Header>

  </soap:Header>

  <soap:Body>

    <m:AddAttachment>

      <m:listName>Attachment List</m:listName>

      <m:listItemID>22</m:listItemID>

      <m:fileName>p90x3-half-hybrid.jpg</m:fileName>

      <m:attachment>[FileData]</m:attachment>

    </m:AddAttachment>

  </soap:Body>

</soap:Envelope>

 

 

It makes me wonder if the AddAttachment web service doesn't work in Workflow Tasks and only work in a document library.

 

I can get it to work in a document library.

Reply
7 Replies
vadim_tabakman
Nintex Employee
Nintex Employee

Re: Is it possible to use AddAttachment web service in Workflow Tasks?

Hi Ben,

did you get an error of any sort? I thought it worked.

cheers,

Vadim

Reply
Not applicable

Re: Is it possible to use AddAttachment web service in Workflow Tasks?

Hi Vadim,

I am suspecting that it is because <m:fileName>{ItemProperty:FileLeafRef}</m:fileName> doesn't work in Workflow Task List. See under the first comment, the filename doesn't show up correctly.

Capture.JPG

The file name shows up correctly in the comment of the document library, web service works and file is copied:

dCapture.JPG

Thanks,

Ben

Reply
shyamshinde08
Forms Fledgling

Re: Is it possible to use AddAttachment web service in Workflow Tasks?

Same for me the Add Attachment Web Method not working for Word and Excel files. For .eml files it works correctly.

Below is the error message:

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

Please let me know what I'm missing in the below WebService call.

<?xml version="1.0" encoding="utf-8"?>

<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/">

  <soap:Header>

  </soap:Header>

  <soap:Body>

    <m:AddAttachment>

      <m:listName>Cases</m:listName>

      <m:listItemID>{WorkflowVariable:ID}</m:listItemID>

      <m:fileName>{ItemProperty:FileLeafRef}</m:fileName>

      <m:attachment>[FileData]</m:attachment>

    </m:AddAttachment>

  </soap:Body>

</soap:Envelope>

Regards,

Shyam

Reply
shyamshinde08
Forms Fledgling

Re: Is it possible to use AddAttachment web service in Workflow Tasks?

May be I just figured it out.

It works for the first time and when you try to attach the same file then it throws an error.

Also, you can attach only one Docx or xlsx file.

When you try to attach multiple files of the same extension it again throws an error.

Don't know how much I'm correct, but this is what I figured it out after multiple rounds of testing.

Please correct me if I'm wrong.

Regards,

Shyam

0 Kudos
Reply
Not applicable

Re: Is it possible to use AddAttachment web service in Workflow Tasks?

If you've found a solution, Shyam Shinde​, select a "correct answer," as it's helpful for other community members seeking answers to problems like yours. Thank you!

0 Kudos
Reply
charlienothing
Nintex Newbie

Re: Is it possible to use AddAttachment web service in Workflow Tasks?

Hi Shyam,  did you ever find a solution to this?

Reply
dsotirov
Nintex Newbie

Re: Is it possible to use AddAttachment web service in Workflow Tasks?

@shyamshinde08  Did you try to elevate the permissions of the Call Web Service action?

I have found that this is usually the case with attaching a file to a list item, nevermind the System Account I use to create and publish the workflow.

I have used a separate workflow which invokes (with a web service) the other one (that attaches the file) but lately I have found it easier to just use an Action Set and put the Call Web Service in it. Within the Action Set configuration you have the option (under Actions) to run as the wokflow creator.

Hope it helps.

Dimiter

0 Kudos
Reply