Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Hi
I want to create a directory from a C# program in Dropbox. When I run this from my desktop PC everything works perfectly. As soon as I run the program from my laptop I get the error message:
Dropbox.Api.BadInputException: "Error in call to API function "files/create_folder_v2": Your app is not permitted to access this endpoint because it does not have the required scope 'files.content.write'. The owner of the app can enable the scope for the app using the Permissions tab on the App Console."
In the app console I set the file permissions to Files-Metadata and Filed-Content to Write. The Permssion Type is Scoped App.
I create a directory with the following code:
using (var dbx = new DropboxClient(accessToken))
{
string folderPath = destinationPath.Replace("\\", "/").ToLower();
if (folderPath.EndsWith("/"))
folderPath = folderPath.Substring(0, folderPath.Length - 1);
try
{
var fldMetadata = await dbx.Files.CreateFolderV2Async(folderPath);
if (fldMetadata.Metadata.IsFolder)
retCode = fldMetadata.Metadata.Name;
else
retCode = "ERROR cannot create " + folderPath;
}
}
I hope you can help me how to work around this error.
Best regards
Peter
That error indicates that you're using an access token/app that does not have the 'files.content.write' scope enabled.
To resolve that, you'll need to enable that 'files.content.write' scope for that particular app, by using the "Permissions" tab of the app's page on the App Console, while signed in to the account that owns that app.
When making changes to the scopes for your app, to save the changes you'll need to click the "Submit" button in the bar at the bottom of the page. (Note that the bottom bar may be obscured by a cookie banner, if you haven't dismissed it yet, so be sure to do so first.)
Also, be aware that just adding a scope to your app via the App Console does not retroactively grant that scope to existing access tokens or refresh tokens. That being the case, to make any API calls that require that scope, you'll need to re-authorize the app to get a new access token (and refresh token, if being used) with that scope.
That error indicates that you're using an access token/app that does not have the 'files.content.write' scope enabled.
To resolve that, you'll need to enable that 'files.content.write' scope for that particular app, by using the "Permissions" tab of the app's page on the App Console, while signed in to the account that owns that app.
When making changes to the scopes for your app, to save the changes you'll need to click the "Submit" button in the bar at the bottom of the page. (Note that the bottom bar may be obscured by a cookie banner, if you haven't dismissed it yet, so be sure to do so first.)
Also, be aware that just adding a scope to your app via the App Console does not retroactively grant that scope to existing access tokens or refresh tokens. That being the case, to make any API calls that require that scope, you'll need to re-authorize the app to get a new access token (and refresh token, if being used) with that scope.
Thank you for your quick response. You gave me the best clue.
All I had to do was create a new token using the “Generate” button in the “Settings” tab in
dropbox.com/developer.
When I do this process on the laptop, I can create a new directory via code on the laptop.
Now I can use my program on both machines.
Best regard
Peter
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!