Add Attachment to list service


Badge +5

Hello,

I'm trying to add attachments from task list to the related list item, I'm using the service _vti_bin/Lists.asmx and the method GetAttachmentCollection , it returns the xml of the attachments from the task form, What I need is to get the base64 binary code from the urls of the attachments so I can use the method AddAttachment , this method takes the parameters:

<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>string</m:listName>

      <m:listItemID>string</m:listItemID>

      <m:fileName>string</m:fileName>

      <m:attachment>base64Binary</m:attachment>

    </m:AddAttachment>

  </soap:Body>

how can I get the base64 binary from the returned attachment urls??

Thanks


5 replies

Userlevel 5
Badge +14

have a look on following Vadim's post Nintex Workflow - Get List Item Attachment in Base64 Custom Action (Happy Thanksgiving) - Vadim Tabakman

Userlevel 6
Badge +12

Hello Omar Taha​ -

Have you been successful in getting this working? We implemented something similar to this. We developed a webservice that you pass in an URL of the SOURCE document (which may be an item in a doc library or another attachment on an item in a list, just need the URL!) and it returns the base64 and file extension via XML. I then take that, and using the AddAttachment service in lists.asmx, I provide the DESTINATION list name, item id, file extension, and the base64.

For us it is nice because I wrapped it in a UDA so that I can call it where ever I need to. Wrap it in some basic logic and you can grab any item's attachments and do something with it and ignore the items that do not have attachments. There are a lot of uses that we have realized now that we have it in place.

The base64 threw us off for a bit, and there are many different ways to go about getting to it, jut need to figure out what works best for you.

Hope this helps!

Badge +5

Hello Jesse,

I solved the problem in similar way, I first grapped the attachments from

the task form using getAttachemntCollection service, and created a custom

service that takes the url of attachment, and returns the base64 encode of

it, and loop through the attachment collection, and that's works for me.

Thanks for your explaination, I appreciate your help.

Best Regards

Userlevel 6
Badge +12

Excellent! Glad it works for you and you were able to wrap some logic around it.

Be sure to mark your question as answered so that others can quickly find it... plus it will make Frank Field​​ happy happy.png

Badge +5

hahaha Done, hope that Frank Field​ is happy now wink.png

Reply