Solved

Get document from Document library as Base64

  • 10 May 2017
  • 8 replies
  • 272 views

Badge +4

Hello,

please is there any posibility, how to store document content from SharePoint online Document library as Base64?

 

I remember that in on-premise version of Nintex Workflow is there that "magic" with [FileData], but it looks, this is not working in Nintex Workflow for O365.

 

Thank you

icon

Best answer by TomaszPoszytek 10 May 2017, 21:53

View original

8 replies

Userlevel 7
Badge +17

Hi!

The only way you can get file contents from SharePoint Online is to get it as binary. You can do it using "Web Request" action to call library REST Api. But there is no OOTB way to encode this binary string to Base64... Possibility you should write your own provider-hosted app to achieve it.

Moreover I found out, that text variables in Nintex for O365 does not support binary strings as they are somehow loosing information about the null bytes. I faced that problem when I was trying to upload such way obtained binary string back to the library - that way created file was corrupted

 Regards,

 Tomasz

Badge +4

Hi Tomasz,

thank you for your response...I've also found that solution with binary file content via REST api call, but for my project is only base64 file content allowed :-(

Regards,

Milan

Userlevel 7
Badge +17

Then the only way I see is to create a custom provider(azure?)-hosted app that will receive fill details, then will get file contents, encode it to Base64 and return such created string. You would be able to use it then via "Web request" action

Regards,

Tomasz

Badge +4

Yes, this is the only way - and already prepared :-)

Now I have all, what I need.

Userlevel 7
Badge +17

Glad I could've guided you to the right solution

Userlevel 7
Badge +17

Milan, can you select one from the answers as "correct"? Regards, Tomasz.

Badge +1

Hi there,


as this is an old post: is there an "integrated solution" for this Problem. Itry to add a word document as list attachment and the file is corrupted using


"<attachment>base64Binary</attachment>"


within the web request and the workflow failed, using


"<attachment>[FileData]</attachment>"


 


Maybe, there is another workaround for this?


Many thanks.

Badge +1

@milan_chaloupka @TomaszPoszytek , thanks again mates, 


question: if the Provider Hosted App sits on an Azure Web Service, and is installed as an Add-In in SharePoint Online, you are saying my Nintex web request action (to get the Base64string) can call it without additional authenticating (since its already has permissions in app catalog)?

Reply