A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
Hi @Giorgio Sfiligoi ,
Thanks for sharing the details and the issues you encountered. I looked into this further, and here is a straightforward approach you can use to access Dropbox files from a .NET MAUI application.
1. Set up the Dropbox app
Start by creating an app in the Dropbox App Console.
Choose the content access based on what your application needs:
- App Folder if your app only needs access to its own Dropbox folder.
- Full Dropbox if it needs access to existing content elsewhere in the user's Dropbox.
Then enable only the permissions required for the operations your application needs. For example:
-
files.metadata.readfor listing and browsing files and folders. -
files.content.readfor reading or downloading file content. -
files.content.writeif you later need to upload files.
2. Add the Dropbox .NET SDK
Install the official Dropbox SDK in your MAUI project:
dotnet add package Dropbox.Api
For an initial test with your own Dropbox account, you can generate an access token from the OAuth 2 section of your Dropbox app settings.
I would recommend using this initially to verify that the Dropbox app configuration, permissions, and file operations are working correctly. The token should not be embedded in your source code or included in a distributed application.
List files from the MAUI application
Once you have a test access token, you can create a DropboxClient and use the Files API:
using Dropbox.Api;
public async Task ListFilesAsync(string accessToken)
{
using var client = new DropboxClient(accessToken);
var result = await client.Files.ListFolderAsync(string.Empty);
foreach (var entry in result.Entries)
{
System.Diagnostics.Debug.WriteLine(entry.Name);
}
}
The returned entries can then be displayed in a MAUI CollectionView or another UI control.
To browse a specific folder, pass its Dropbox path to ListFolderAsync. If Dropbox indicates that additional entries are available, make sure to handle pagination rather than relying only on the first result.
3. Read or download a selected file
Once listing and folder navigation are working, you can use the same DropboxClient to retrieve the content of a selected file.
For example, for a small text file, the application can download the content and display it in the MAUI UI. This requires the corresponding content-read permission in addition to metadata access.
I would start by confirming that listing, browsing, and reading a file work correctly before extending the application with additional operations such as saving downloads locally or uploading files.
The Dropbox API Explorer can also help verify individual Dropbox API requests and permissions independently. However, it is primarily a Dropbox API testing resource rather than a .NET MAUI-specific implementation guide.
If you found my response helpful or informative, I would greatly appreciate it if you could follow this guide for your confirmation.
Thank you.