Download data from ONEDRIVE using command line

Sushant Agarwal
Jan 23, 2021
Photo by Caspar Camille Rubin on Unsplash

Google Chrome or Mozilla Firerfox both provide an option to copy download link specifically for cURL. This option will generate cURL with all required things such as User agent for downloading things from the side. To get that,

- Open the URL in either of the browser.
- Open Developer options using Ctrl+Shift+I.
- Go to Network tab.
- Now click on download. Saving file isn’t required. We only need the network activity while browser requests the file from the server.
- A new entry will appear which would look like “download.aspx?…”.
- Right click on that and `Copy → Copy as cURL`.
- Paste the copied content directly in the terminal and append ‘--output file.extension’ to save the content in file.extension since terminal isn’t capable of showing binary data.

Example:

curl https://xyz.sharepoint.com/personal/someting/_layouts/15/download.aspx?UniqueId=cefb6082%2D696e%2D4f23%2D8c7a%2 …. some long text …. cCtHR3NuTy82bWFtN1JBRXNlV2ZmekZOdWp3cFRsNTdJdjE2c2syZmxQamhGWnMwdkFBeXZlNWx2UkxDTkJic2hycGNGazVSTnJGUnY1Y1d0WjF5SDJMWHBqTjRmcUNUUWJxVnZYb1JjRG1WbEtjK0VIVWx2clBDQWNyZldid1R3PT08L1NQPg==; cucg=1’ --compressed --output file.extension

--

--

Sushant Agarwal

My passion is to learn new technologies and apply them. I have an experience of working with Edge devices like Arduino, RaspBerry Pie, NVIDIA Jetson Nano and In