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?

Your Answer

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

Browse other questions tagged or ask your own question.