Integrate Salesforce and Sharepoint using Aura component
Do you want to upload file(i.e up-to 2 GB) to sharepoint from aura component? If yes, here’s the solution for you.
Step 1:
Create a aura component(.cmp) and define a lightning:input(type=’file’) component to get the file from user.
Step 2:
Define a onchange event handler(handleFilesChange) in .js controller file.
Step 3:
Define a .js helper file that has actual logic to upload a file to Share Point.
initiateFileUpload():
- Creates the dummy file in sharepoint, determines the chunk sizes based on the file size and the share point REST method for each chunk upload.
uploadFile():
- Recursively called to upload each chunk to the sharepoint.
convertFileToBlobChunks():
- Slices the file blob into the chunk.
createGuid():
- Generates the unique global identifier.