3

I need to write a workflow that reads the content of attachment of a list item, convert it to base64 encoded string and then invoke a custom REST service.

I know I can access /_api/web/lists/getbytitle('MyList')/items(" + id + ")/AttachmentFiles and get the server relative URL of the attachment from result.

But I'm not sure how to get the contents of that file and convert it to base64 string.

Update:

I've found the following REST API that allows me to read the content of the attachment:

/_api/web/getfilebyserverrelativeurl('server relative URL of attachment from earlier call')/$value

Now the question remains that how to get this content in base64 format?

  • Would you be able to post the steps on how to accomplish this in SPD. I am desperately in need to convert files to base64. – user51776 Oct 25 '19 at 19:25
0

I know this is a very old question, but maybe my answer can help people with the same problem.

I was struggling with this issue also.

I replaced the web request of the document content (/_api/web/getfilebyserverrelativeurl('server relative URL of attachment from earlier call')/$value) from the workflow to a .NET service.

In the service I converted the byte array to a base64 string.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.