> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.dropboxapi.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.dropboxapi.com/_mcp/server.

# .NET

#### Overview

## Dropbox.NET

Dropbox.NET is our .NET SDK for API v2, which helps you easily integrate Dropbox into your app. The Dropbox.NET SDK is a Portable Class Library that works with multiple platforms including Windows, Windows Phone, and Mono.

### Code

[Dropbox.NET](https://github.com/dropbox/dropbox-sdk-dotnet) - Dropbox.NET is open source on GitHub.

### Sample apps

Several examples can be found in the [examples](https://github.com/dropbox/dropbox-sdk-dotnet/tree/master/dropbox-sdk-dotnet/Examples) directory:

* [SimpleBlogDemo](https://github.com/dropbox/dropbox-sdk-dotnet/tree/master/dropbox-sdk-dotnet/Examples/SimpleBlogDemo) - An ASP.NET MVC application that creates a simple blogging platform and shows how to upload and download files.
* [SimpleBusinessDashboard](https://github.com/dropbox/dropbox-sdk-dotnet/tree/master/dropbox-sdk-dotnet/Examples/SimpleBusinessDashboard) - An ASP.NET MVC application that creates a simple business dashboard, showcasing the Dropbox Business endpoints.
* [SimpleTest](https://github.com/dropbox/dropbox-sdk-dotnet/tree/master/dropbox-sdk-dotnet/Examples/SimpleTest) - A windows console application that demonstrates basic use of the SDK; this also contains code that connects with OAuth2 using WPF.
* [UniversalDemo](https://github.com/dropbox/dropbox-sdk-dotnet/tree/master/dropbox-sdk-dotnet/Examples/UniversalDemo/UniversalDemo) - A slide show app for both Windows Store and Windows Phone 8.1

#### Install

## Install Dropbox.NET

We recommend using [NuGet](https://www.nuget.org/) to install the new Dropbox.NET SDK.

To install `Dropbox.Api`, run the following command in the [Package Manager Console](http://docs.nuget.org/consume/package-manager-console):

```
    PM> Install-Package Dropbox.Api
```

That's it! Now you're ready to get started with the [tutorial](#tutorial).

#### Tutorial

## Dropbox.NET tutorial

A good way to start using Dropbox.NET is to follow this quick tutorial. Just make sure you have the Dropbox.NET SDK [installed](#install) first!

### Register a Dropbox API app

To use the Dropbox API, you'll need to register a new app in the [App Console](https://www.dropbox.com/developers/apps). Select Dropbox API app and choose your app's permission. You'll need to use the app key created with this app to access API v2.

### Link an account

In order to make calls to the API, you'll need an instance of the [`DropboxClient`](https://dropbox.github.io/dropbox-sdk-dotnet/gh-pages/obj/api/Dropbox.Api.DropboxClient.html) object. To instantiate, pass in the access token for the account you want to link.

You can [generate an access token](https://dropbox.tech/developers/generate-an-access-token-for-your-own-account) for testing with your own account through the [App Console](https://www.dropbox.com/developers/apps). In order to authorize additional users, the Dropbox.NET SDK contains helper methods for [using OAuth with Dropbox](https://dropbox.github.io/dropbox-sdk-dotnet/gh-pages/obj/api/Dropbox.Api.DropboxOAuth2Helper.html).

Here's an example where we set up the `DropboxClient` and check the current user by calling [`GetCurrentAccountAsync`](https://dropbox.github.io/dropbox-sdk-dotnet/gh-pages/obj/api/Dropbox.Api.Users.Routes.UsersUserRoutes.html#Dropbox_Api_Users_Routes_UsersUserRoutes_GetCurrentAccountAsync), which returns an instance of [`FullAccount`](https://dropbox.github.io/dropbox-sdk-dotnet/gh-pages/obj/api/Dropbox.Api.Users.FullAccount.html):

```csharp
using System;
using System.Threading.Tasks;
using Dropbox.Api;

class Program
{
    static void Main(string [] args)
    {
        var task = Task.Run((Func<Task>)Program.Run);
        task.Wait();
    }

    static async Task Run()
    {
        using (var dbx = new DropboxClient("YOUR ACCESS TOKEN"))
        {
            var full = await dbx.Users.GetCurrentAccountAsync();
            Console.WriteLine("{0} - {1}", full.Name.DisplayName, full.Email);
        }
    }
}
```

### Try some API requests

Now that you have a DropboxClient handy, let's try making some API requests. You can use the `DropboxClient` object you instantiated above to make API calls. Let's try out some of the [Files](https://dropbox.github.io/dropbox-sdk-dotnet/gh-pages/obj/api/Dropbox.Api.Files.Routes.FilesUserRoutes.html) requests.

To list all the contents in the user's root directory:

```csharp
async Task ListRootFolder(DropboxClient dbx)
{
    var list = await dbx.Files.ListFolderAsync(string.Empty);

    // show folders then files
    foreach (var item in list.Entries.Where(i => i.IsFolder))
    {
        Console.WriteLine("D  {0}/", item.Name);
    }

    foreach (var item in list.Entries.Where(i => i.IsFile))
    {
        Console.WriteLine("F{0,8} {1}", item.AsFile.Size, item.Name);
    }
}
```

To download a file:

```csharp
async Task Download(DropboxClient dbx, string folder, string file)
{
    using (var response = await dbx.Files.DownloadAsync(folder + "/" + file))
    {
        Console.WriteLine(await response.GetContentAsStringAsync());
    }
}
```

To upload a file:

```csharp
async Task Upload(DropboxClient dbx, string folder, string file, string content)
{
    using (var mem = new MemoryStream(Encoding.UTF8.GetBytes(content)))
    {
        var updated = await dbx.Files.UploadAsync(
            folder + "/" + file,
            WriteMode.Overwrite.Instance,
            body: mem);
        Console.WriteLine("Saved {0}/{1} rev {2}", folder, file, updated.Rev);
    }
}
```

Find out more details in the [full documentation](https://dropbox.github.io/dropbox-sdk-dotnet/).

#### Documentation

## Dropbox.NET documentation

Here's the [full documentation](https://dropbox.github.io/dropbox-sdk-dotnet/) for the Dropbox.NET SDK.