Overview
Saving microphone audio recorded in PowerApps into SharePoint library has been discussed long time, but AFAIK there is no “low-coding” solution for this challenge.
Today, we have ability to convert images and audios to base64 string by using JSON function in PowerApps. (See here)
and here I summarized simple & low-coding solution for saving audio from Microphone to SharePoint Library using JSON and Flow.
NOTE: This approach only works well in PC browser, not mobile device.
PowerApps
First I assumed that there added 1 Microphone control, TextInput, and Button in my app.
TextInput is just used as file name, and button triggers Flow described later.
For Microphone control, set below function in OnStop property:
Set(tmpJson,JSON(MicrophoneAudio1.Audio,IncludeBinaryData));
Set(strB64Audio, Mid(tmpJson,25,Len(tmpJson)-25);
where IncludeBinaryData is key to convert Microphone audio into base64 string.
The remaining part Mid(...) is extracting base64-ed content from generated string.
Flow
Saving base64ed audio into SharePoint library is very simple and straightforward.
- Initialize string variable using "Ask in PowerApps" with name "b64Audio"
- Add Create file action of SharePoint connector with
- Filename : Ask in PowerApps
- Filecontent : base64ToBinary(variables('b64Audio'))
Save flow with name "SaveAudio"
Ref: http://johnliu.net/blog/2017/7/building-non-json-webservices-with-flow
Back to PowerApps
We can now store microphone audio to SharePoint library.
Last, execute flow "SaveAudio" by select button:
OnSelect : SaveAudio.Run(strB64Audio,TextInput1.Text)
Check result
This provides you easy & low-coding solution to save microphone audio to SharePoint list.
You can apply this method for meeting note with recording or some fun apps :-)