Click or drag to resize

DropboxClientWithPathRoot Method

Set the value for Dropbox-Api-Path-Root header. This allows accessing content outside of user's home namespace. Below is sample code of accessing content inside team space. See Namespace Guide for details about user space vs team space.
// Fetch root namespace info from user's account info.
var account = await client.Users.GetCurrentAccountAsync();

if (!account.RootInfo.IsTeam)
{
    Console.WriteLine("This user doesn't belong to a team with shared space.");
}
else
{
    try
    {
        // Point path root to namespace id of team space.
        client = client.WithPathRoot(new PathRoot.Root(account.RootInfo.RootNamespaceId));
        await client.Files.ListFolderAsync(path);
    }
    catch (PathRootException ex)
    {
        // Handle race condition when user switched team.
        Console.WriteLine(
            "The user's root namespace ID has changed to {0}",
            ex.ErrorResponse.AsInvalidRoot.Value);
    }
}

Namespace:  Dropbox.Api
Assembly:  Dropbox.Api (in Dropbox.Api.dll) Version: 4.0
Syntax
public DropboxClient WithPathRoot(
	PathRoot pathRoot
)

Parameters

pathRoot
Type: Dropbox.Api.CommonPathRoot
The path root object.

Return Value

Type: DropboxClient
A DropboxClient instance with Dropbox-Api-Path-Root header set.
See Also