NOTE: UPDATE: ZappySys has released a brand new API Connector for SSIS OneDrive which makes it much simpler to integrate OneDrive data inside SSIS and SQL Server compared to the steps listed in this article. You can still use steps from this article but if you are new to API or want to avoid learning curve with API then use newer approach.
Please visit this page to see all Pre-Configured ready to use API connectors which you can use in SSIS API Source / SSIS API Destination OR API ODBC Driver (for non-SSIS Apps such as Excel, Power BI, Informatica).
In our previous article, we saw how to connect to Office 365 API using SSIS PowerPack.
In this quick post, we will see how to upload a file to OneDrive using REST API Task.
If you have file more than 60MB then it is more complex and not supported by ZappySys PowerPack (You have to split file bytes in range but for less than 60 MB below method will work fine)
Uploading file less than 60MB
For files of more than 4 Mb but less than 60 MB, we need 3 steps (see below).
Step-1 : Create OAuth Connection Manager.
Step-2 : Create SSIS Variables.
Step-3 : Create 3 steps as below (Use ZS Rest API task , ZS Advanced File System Task ).
Step-4 : Save URL for Upload Session to variable.
Step-5 : Get File Size in Bytes and save to variable.
Step-6 : Use Upload URL to push file content in stream mode.
Uploading file less than 4 MB
For small file all it takes is just one call to below URL (change folder and file name)