OneDrive Personal File System Provider
- 2 minutes to read
The OneDrive file system provider (personal account) (OneDrivePersonalFileSystemProvider) allows you to connect the ASPxFileManager to OneDrive (using client authorization).
Prerequisites
To sets permissions for your application, register your application using Microsoft Graph or Azure Active Directory (OneDrive for Business). This allows your application to use OneDrive APIs to work with the user’s storage.
Provider Settings
Set the ASPxFileManager.ProviderType property to FileManagerProviderType.OneDrivePersonal to allow ASPxFileManager to manage files and folders in OneDrive.
The OneDrivePersonalFileSystemProvider class allows you to access files’ and folders’ hierarchy and manipulate these files in the file manager.
Do the following to connect the ASPxFileManager to OneDrive:
Use the AccountManager.RegisterOneDrive method to register the OneDrive account in the global.asax file.
AccountManager.RegisterOneDrive("FileManagerOneDrivePersonalAccount", "f49c387c-1c25-4f27-855b-dfd3fd3", "..+SKN3n5H0/KZVb6c=...");
Use the ASPxFileManager.SettingsOneDrivePersonal property to specify the OneDrive account settings:
- FileManagerOneDriveProviderSettings.AccountName - Specifies the OneDrive account’s name.
- FileManagerOneDriveProviderSettings.RedirectUri - Specifies the redirect URL to which the browser is redirected when authentication is complete.
- FileManagerOneDrivePersonalProviderSettings.AuthorizationEndpoint - Specifies the URL to which the application redirects an end-user for authorization.
- FileManagerOneDriveProviderSettings.TokenEndpoint - Specifies the URL that the application uses to get the token.
Microsoft Graph authentication:
<dx:ASPxFileManager ID="FileManager" runat="server" ProviderType="OneDrivePersonal"> <SettingsOneDrivePersonal AccountName="OneDrive" AuthorizationEndpoint="https://login.microsoftonline.com/common/oauth2/v2.0/authorize" TokenEndpoint="https://login.microsoftonline.com/common/oauth2/v2.0/token" RedirectUri="http://mysite.com/" /> ... </dx:ASPxFileManager>
Azure Active Directory authentication:
<dx:ASPxFileManager ID="FileManager" runat="server" ProviderType="OneDrivePersonal"> <SettingsOneDrivePersonal AccountName="OneDrive" AuthorizationEndpoint="https://login.microsoftonline.com/common/oauth2/authorize" TokenEndpoint="https://login.microsoftonline.com/common/oauth2/token" RedirectUri="http://mysite.com/" /> ... </dx:ASPxFileManager>
The ASPxFileManager allows you to handle every request to OneDrive (the ASPxFileManager.CloudProviderRequest event).