Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

rhernandez8305's avatar
rhernandez8305
Helpful | Level 6
8 years ago
Solved

DownloadAsync error

I tried download all folders/files from DropBox.Api but I received this error:

 

Value should match pattern '\A(?:(/(.|[\r\n])*|id:.*)|(rev:[0-9a-f]{9,})|(ns:[0-9]+(/.*)?))\z'
Parameter name: path

 

My code is:

 

using (var response = await dbx.Files.DownloadAsync("/folder/File.ext" ))
                        {
                           //code
                        }

 

Thanks a lot!!!

  • Thanks for your reply, I resolved it. This is part of my code:

    I get the "PathLower" property from the metadata's files:

    the path's format  is: "/folder/MyFile.ext"

     

    using (var dbx = new DropboxClient("KeyApi"))
                {
                    var list = await dbx.Files.ListFolderAsync(string.Empty, recursive: true);

                    foreach (var item in list.Entries.Where(i => i.IsFile))
                    {
                        string urlFile = item.AsFile.PathLower;
                        using (var response = await dbx.Files.DownloadAsync(urlFile))
                        {
                            //code
                        }
                    }
                }

     

    Thanks a lot.

2 Replies

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago
    That error is indicating that the `path` value you supplied doesn't match the expected format. The value "/folder/File.ext" would match, but it looks like that's just an example. Can you share the exact value you're supplying when you get this error?

    For example, if you're supplying a file path, make sure it starts with a "/".
  • rhernandez8305's avatar
    rhernandez8305
    Helpful | Level 6
    8 years ago

    Thanks for your reply, I resolved it. This is part of my code:

    I get the "PathLower" property from the metadata's files:

    the path's format  is: "/folder/MyFile.ext"

     

    using (var dbx = new DropboxClient("KeyApi"))
                {
                    var list = await dbx.Files.ListFolderAsync(string.Empty, recursive: true);

                    foreach (var item in list.Entries.Where(i => i.IsFile))
                    {
                        string urlFile = item.AsFile.PathLower;
                        using (var response = await dbx.Files.DownloadAsync(urlFile))
                        {
                            //code
                        }
                    }
                }

     

    Thanks a lot.

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

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!