File upload to Microsoft OneDrive
This article show how to configure ASPRunner.NET to upload files to Microsft OneDrive cloud storage.
Configuration
Create a new app registration
Proceed to Azure -> App registrations -> New registrations
Name:
Supported account types: This parameter can not be changed later.
If you plan to use your personal OneDrive account, choose Personal Accounts only
Redirect URI: - you can change this parameter later
Platform: Web
/oauthcallback
For example:
https://mysite.com/app/oauthcallback
or
http://localhost:8086/oauthcallback
Press Register to create the application.
Configure app registration
1. App registrations -> Your app, Proceed to Overview.
Application (client) ID - copy to ASPRunner.NET as Client ID
2. Proceed to Certificates & secrets, click 'New client secret'
After the secret is created copy its Value (not the Secret ID!) to the Client Secret field in ASPRunner.NET
3. Proceed to API Permissions
Click Microsoft Graph and add permissions.
Use the search tool.
The following permissions need to be added:
offline_access
Files.ReadWrite
4. Proceed to Authentication
Add the Redirect URL if you didn't do that before or need to add a new one.
Press Add platform, choose Web.
See above which Redirect URL to enter.
5. Proceed to OneDrive.
Note the URL in browser's address box. It should be something like this
https://onedrive.live.com/?id=root&cid=7FD32AC638D2A7
Copy the cid parameter value to Drive field in ASPRunner.NET, for example: 7FD32AC638D2A7
You are all set. Now you can run your application.
Important note
After the project is built and published, open it in the web browser and proceed to any page of a table where cloud storage is used. You will be redirected to Microsoft's site to log in.
Log in under the account that should be used to store the files. Then the application will save the credentials, and no further login will be needed.
The credentials are saved in \templates_c\onedrive.json file respectively.
If you need to change the OneDrive configuration and start storing files under a different account, delete that file, then close all browser windows to clear the session. Open any page where cloud storage is used in the browser again and log in to Microsoft using your new account.