Class DropboxClient
The client which contains endpoints which perform user-level actions.
Implements
Inherited Members
Namespace: Dropbox.Api
Assembly: Dropbox.Api.dll
Syntax
public sealed class DropboxClient : DropboxClientBase, IDisposable
Constructors
| Improve this Doc View SourceDropboxClient(String)
Initializes a new instance of the DropboxClient class.
Declaration
public DropboxClient(string oauth2Token)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | oauth2Token | The oauth2 access token for making client requests. |
DropboxClient(String, DropboxClientConfig)
Initializes a new instance of the DropboxClient class.
Declaration
public DropboxClient(string oauth2AccessToken, DropboxClientConfig config)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | oauth2AccessToken | The oauth2 access token for making client requests. |
| DropboxClientConfig | config | The DropboxClientConfig. |
DropboxClient(String, DateTime)
Initializes a new instance of the DropboxClient class.
Declaration
public DropboxClient(string oauth2AccessToken, DateTime oauth2AccessTokenExpiresAt)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | oauth2AccessToken | The oauth2 access token for making client requests. |
| System.DateTime | oauth2AccessTokenExpiresAt | The time when the current access token expires, can be null if using long-lived tokens. |
DropboxClient(String, DateTime, DropboxClientConfig)
Initializes a new instance of the DropboxClient class.
Declaration
public DropboxClient(string oauth2AccessToken, DateTime oauth2AccessTokenExpiresAt, DropboxClientConfig config)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | oauth2AccessToken | The oauth2 access token for making client requests. |
| System.DateTime | oauth2AccessTokenExpiresAt | The time when the current access token expires, can be null if using long-lived tokens. |
| DropboxClientConfig | config | The DropboxClientConfig. |
DropboxClient(String, String)
Initializes a new instance of the DropboxClient class.
Declaration
public DropboxClient(string oauth2RefreshToken, string appKey)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | oauth2RefreshToken | The oauth2 access token for making client requests. |
| System.String | appKey | The app key to be used for refreshing tokens. |
DropboxClient(String, String, DropboxClientConfig)
Initializes a new instance of the DropboxClient class.
Declaration
public DropboxClient(string oauth2RefreshToken, string appKey, DropboxClientConfig config)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | oauth2RefreshToken | The oauth2 access token for making client requests. |
| System.String | appKey | The app key to be used for refreshing tokens. |
| DropboxClientConfig | config | The DropboxClientConfig. |
DropboxClient(String, String, DateTime, String)
Initializes a new instance of the DropboxClient class.
Declaration
public DropboxClient(string oauth2AccessToken, string oauth2RefreshToken, DateTime oauth2AccessTokenExpiresAt, string appKey)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | oauth2AccessToken | The oauth2 access token for making client requests. |
| System.String | oauth2RefreshToken | The oauth2 refresh token for refreshing access tokens. |
| System.DateTime | oauth2AccessTokenExpiresAt | The time when the current access token expires, can be null if using long-lived tokens. |
| System.String | appKey | The app key to be used for refreshing tokens. |
DropboxClient(String, String, DateTime, String, DropboxClientConfig)
Initializes a new instance of the DropboxClient class.
Declaration
public DropboxClient(string oauth2AccessToken, string oauth2RefreshToken, DateTime oauth2AccessTokenExpiresAt, string appKey, DropboxClientConfig config)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | oauth2AccessToken | The oauth2 access token for making client requests. |
| System.String | oauth2RefreshToken | The oauth2 refresh token for refreshing access tokens. |
| System.DateTime | oauth2AccessTokenExpiresAt | The time when the current access token expires, can be null if using long-lived tokens. |
| System.String | appKey | The app key to be used for refreshing tokens. |
| DropboxClientConfig | config | The DropboxClientConfig. |
DropboxClient(String, String, DateTime, String, String)
Initializes a new instance of the DropboxClient class.
Declaration
public DropboxClient(string oauth2AccessToken, string oauth2RefreshToken, DateTime oauth2AccessTokenExpiresAt, string appKey, string appSecret)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | oauth2AccessToken | The oauth2 access token for making client requests. |
| System.String | oauth2RefreshToken | The oauth2 refresh token for refreshing access tokens. |
| System.DateTime | oauth2AccessTokenExpiresAt | The time when the current access token expires, can be null if using long-lived tokens. |
| System.String | appKey | The app key to be used for refreshing tokens. |
| System.String | appSecret | The app secret to be used for refreshing tokens. |
DropboxClient(String, String, DateTime, String, String, DropboxClientConfig)
Initializes a new instance of the DropboxClient class.
Declaration
public DropboxClient(string oauth2AccessToken, string oauth2RefreshToken, DateTime oauth2AccessTokenExpiresAt, string appKey, string appSecret, DropboxClientConfig config)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | oauth2AccessToken | The oauth2 access token for making client requests. |
| System.String | oauth2RefreshToken | The oauth2 refresh token for refreshing access tokens. |
| System.DateTime | oauth2AccessTokenExpiresAt | The time when the current access token expires, can be null if using long-lived tokens. |
| System.String | appKey | The app key to be used for refreshing tokens. |
| System.String | appSecret | The app secret to be used for refreshing tokens. |
| DropboxClientConfig | config | The DropboxClientConfig. |
DropboxClient(String, String, String)
Initializes a new instance of the DropboxClient class.
Declaration
public DropboxClient(string oauth2RefreshToken, string appKey, string appSecret)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | oauth2RefreshToken | The oauth2 refresh token for refreshing access tokens. |
| System.String | appKey | The app key to be used for refreshing tokens. |
| System.String | appSecret | The app secret to be used for refreshing tokens. |
DropboxClient(String, String, String, DropboxClientConfig)
Initializes a new instance of the DropboxClient class.
Declaration
public DropboxClient(string oauth2RefreshToken, string appKey, string appSecret, DropboxClientConfig config)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | oauth2RefreshToken | The oauth2 refresh token for refreshing access tokens. |
| System.String | appKey | The app key to be used for refreshing tokens. |
| System.String | appSecret | The app secret to be used for refreshing tokens. |
| DropboxClientConfig | config | The DropboxClientConfig. |
DropboxClient(String, String, String, String, DropboxClientConfig)
Initializes a new instance of the DropboxClient class.
Declaration
public DropboxClient(string oauth2AccessToken, string oauth2RefreshToken, string appKey, string appSecret, DropboxClientConfig config)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | oauth2AccessToken | The oauth2 access token for making client requests. |
| System.String | oauth2RefreshToken | The oauth2 refresh token for refreshing access tokens. |
| System.String | appKey | The app key to be used for refreshing tokens. |
| System.String | appSecret | The app secret to be used for refreshing tokens. |
| DropboxClientConfig | config | The DropboxClientConfig. |
Properties
| Improve this Doc View SourceAccount
Gets the Account routes.
Declaration
public AccountUserRoutes Account { get; }
Property Value
| Type | Description |
|---|---|
| AccountUserRoutes |
Auth
Gets the Auth routes.
Declaration
public AuthUserRoutes Auth { get; }
Property Value
| Type | Description |
|---|---|
| AuthUserRoutes |
Check
Gets the Check routes.
Declaration
public CheckUserRoutes Check { get; }
Property Value
| Type | Description |
|---|---|
| CheckUserRoutes |
Contacts
Gets the Contacts routes.
Declaration
public ContactsUserRoutes Contacts { get; }
Property Value
| Type | Description |
|---|---|
| ContactsUserRoutes |
FileProperties
Gets the FileProperties routes.
Declaration
public FilePropertiesUserRoutes FileProperties { get; }
Property Value
| Type | Description |
|---|---|
| FilePropertiesUserRoutes |
FileRequests
Gets the FileRequests routes.
Declaration
public FileRequestsUserRoutes FileRequests { get; }
Property Value
| Type | Description |
|---|---|
| FileRequestsUserRoutes |
Files
Gets the Files routes.
Declaration
public FilesUserRoutes Files { get; }
Property Value
| Type | Description |
|---|---|
| FilesUserRoutes |
Paper
Gets the Paper routes.
Declaration
public PaperUserRoutes Paper { get; }
Property Value
| Type | Description |
|---|---|
| PaperUserRoutes |
Sharing
Gets the Sharing routes.
Declaration
public SharingUserRoutes Sharing { get; }
Property Value
| Type | Description |
|---|---|
| SharingUserRoutes |
Users
Gets the Users routes.
Declaration
public UsersUserRoutes Users { get; }
Property Value
| Type | Description |
|---|---|
| UsersUserRoutes |
Methods
| Improve this Doc View SourceRefreshAccessToken(String[])
Refreshes access token regardless of if existing token is expired.
Declaration
public Task<bool> RefreshAccessToken(string[] scopeList)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String[] | scopeList | subset of scopes to refresh token with, or null to refresh with all scopes. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<System.Boolean> | true if token is successfully refreshed, false otherwise. |
WithPathRoot(PathRoot)
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);
}
}
Declaration
public DropboxClient WithPathRoot(PathRoot pathRoot)
Parameters
| Type | Name | Description |
|---|---|---|
| PathRoot | pathRoot | The path root object. |
Returns
| Type | Description |
|---|---|
| DropboxClient | A DropboxClient instance with Dropbox-Api-Path-Root header set. |