Your workflow is unique 👨‍💻 -  tell us how you use Dropbox here.

Forum Discussion

Nenciu D.'s avatar
Nenciu D.
New member | Level 1
9 years ago

Create a new folder using FilesRoutes.BeginCreateFolder method

Hi , 

 

I don't understand how to use this method . What is supposed to do an AsyncCallback? Can you please provide me an example ? 

Can I create a new folder in my root folder using this method? 

Thank you

1 Reply

Replies have been turned off for this discussion
  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    9 years ago

    Yes, there are a few ways to do this. Here are three different versions I put together:

                 // blocking
                Dropbox.Api.Files.FolderMetadata folderMetadata = await client.Files.CreateFolderAsync("/new_folder_via_CreateFolderAsync");
                Console.WriteLine(folderMetadata.PathLower);
             static void CompleteCreateFolder(IAsyncResult result)
            {
                Console.WriteLine("CreateFolder completed.");
                Dropbox.Api.Files.FolderMetadata folderMetadata = client.Files.EndCreateFolder(result);
                Console.WriteLine(folderMetadata.PathLower);

            }
    ...
                // non-blocking
                IAsyncResult result = client.Files.BeginCreateFolder("/new_folder_via_BeginCreateFolder", new AsyncCallback(CompleteCreateFolder));
                 // blocking
                Dropbox.Api.Files.FolderMetadata folderMetadata = client.Files.EndCreateFolder(client.Files.BeginCreateFolder ("/new_folder_via_BeginCreateFolder"));
                Console.WriteLine(folderMetadata.PathLower);

About Dropbox API Support and Feedback

Node avatar for Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

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!