I'm working on a SharePoint add-in, whitch retrieves a file (and metadata) from a rest api and store the file in a SharePoint document library (with the name of the document). Requirement is that the add-in supports Classic as Modern sites. That's way SPFX is not an option.
I'm able to get the JSON from REST, but I'm a little stuck in my next steps.
The JSON format is straight forward:
{
size: 2399,
ContentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
Data: "UEsDBBQAAAAIAIBxVFC38a4kqQAAAA4BAAATAAAAY3VzdG9tWG1sL2l0ZW0xLnhtbK2PwQE...............etc",
filename: "Invoice298393.docx"
}
I can save the file as Base64. My solution is similar to https://docs.microsoft.com/en-us/sharepoint/dev/sp-add-ins/upload-a-file-by-using-the-rest-api-and-jquery. This example retrieves it's data from a input contol and streams it data from there,....
I'll like to know how to get the json.Data
and upload it to a SharePoint Document library.
Thanks in advance...