Skip to main content

OneDrive Personal File System Provider

  • 2 minutes to read

The OneDrive Personal file system provider (OneDrivePersonalFileSystemProvider) allows you to connect ASPxFileManager to OneDrive (using client authorization).

Prerequisites

Register your application with Microsoft Graph or Azure Active Directory (OneDrive for Business) to set application permissions. 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 the file and folder hierarchy, and manipulate these files in the file manager.

ASPxFilteManager-OneDRivePersonalProvider

Do the following to connect ASPxFileManager to OneDrive:

Call 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 URL to which the browser is redirected when authentication is complete.
FileManagerOneDrivePersonalProviderSettings.AuthorizationEndpoint
Specifies the URL to which the application redirects a user for authorization.
FileManagerOneDriveProviderSettings.TokenEndpoint
Specifies the URL that the application uses to get the token.
<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>

ASPxFileManager allows you to handle every request to OneDrive (the ASPxFileManager.CloudProviderRequest event).

Important

The OneDrivePersonalFileSystemProvider provider gives access to personal OneDrive storage that requires client authentication.