cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
If you’ve changed your email address, now's the perfect time to update it on your Dropbox account and we’re here to help! Learn more here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

What path argument should I pass to .NET CreateSharedLinkWithSettingsAsync()

What path argument should I pass to .NET CreateSharedLinkWithSettingsAsync()

Esikhoob
Helpful | Level 5
Go to solution

Hi

In our Website, written with ASP.NET and C#, we want to use .NET API to get shared link for a file. I found the method for this purpose named:  CreateSharedLinkWithSettingsAsync() but all my tries in passing path argument, result in these errors:

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

[Dropbox.Api.Sharing.CreateSharedLinkWithSettingsError]: path/not_found/

[Dropbox.Api.Sharing.CreateSharedLinkWithSettingsError]:path/malformed_path/

I understood from the first error that I should put an '/' at the beginning of the path, but canot solve other errors.

please help me

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

@Esikhoob A 'path/malformed_path' error would indicate that the path value is invalid due to not being formed correctly; for example, this can occur if there is whitespace at the end of the path value.

 

A 'path/not_found' error would indicate that the path value is properly formed, but nothing was found at the specified path in the connected account/root.

 

Apps with the "app folder" access type are automatically rooted in the special app folder created for the app in the connected account, so yes, if you have a file named "Iran4K.mp4" directly in the app folder in the connected account, you would use a path value of "/Iran4K.mp4".

 

To list the contents of whatever root your app is accessing, such as the app folder, you can use ListFolderAsync/ListFolderContinueAsync starting with 'path' set to the empty string "'.

View solution in original post

5 Replies 5

Здравко
Legendary | Level 20
Go to solution

Hi @Esikhoob,

If you try to list your account content, is there such entry which path match to the path you're passing during link creation (take in mind root namespace has to be the same for business accounts)? 🧐 If no, that's why the path can't be found. 😉 If you're trying to pass local path, it won't work, both as format and as pointed file/folder location.

Good luck.

Esikhoob
Helpful | Level 5
Go to solution

Hi

I can see the path I have passed during link creation, in my Dropbox`s account. I have successfully created shared links with equivalent javascript SDK`s function; I am using the same path that was successful there.

One question is: shouldn`t I enter path of files which exist in this App folder?

 


. . . (take in mind root namespace has to be the same for business accounts)? 🧐

What is root namespace?

 


 . . . If you're trying to pass local path, it won't work, .  . . 

What you mean by local path. If I have a file named "Iran4K.mp4" in this App folder, should n`t I enter like this:

 

CreateSharedLinkWithSettingsAsync("/Iran4K.mp4")

 

 

Thanks in advance

Greg-DB
Dropbox Staff
Go to solution

@Esikhoob A 'path/malformed_path' error would indicate that the path value is invalid due to not being formed correctly; for example, this can occur if there is whitespace at the end of the path value.

 

A 'path/not_found' error would indicate that the path value is properly formed, but nothing was found at the specified path in the connected account/root.

 

Apps with the "app folder" access type are automatically rooted in the special app folder created for the app in the connected account, so yes, if you have a file named "Iran4K.mp4" directly in the app folder in the connected account, you would use a path value of "/Iran4K.mp4".

 

To list the contents of whatever root your app is accessing, such as the app folder, you can use ListFolderAsync/ListFolderContinueAsync starting with 'path' set to the empty string "'.

Здравко
Legendary | Level 20
Go to solution

Hi again @Esikhoob,

While you're saying "in my Dropbox's account", be aware this can mean many different things. - i.e. in your web browser, in your local folder (if you have  installed the official Dropbox application, that what I mean with "local" in my previous post), in the response of SDK call 'ListFolderAsync(path);' (I asked you to check for existence using this way), etc.

 


@Esikhoob wrote:

...

One question is: shouldn`t I enter path of files which exist in this App folder?

...


If your application works in App folder you can only point files/folders residing within this application folder only - nothing outside! Take this in mind.

 


@Esikhoob wrote:

... I have successfully created shared links with equivalent javascript SDK`s function; I am using the same path that was successful there.

...


In this case you should be able to use the same path used in Javascript SDK. When they're the same registered application, no reason the same path to work in one of the cases and no on the other. You should take in mind that if there is a link created already, pointing the file, error will be returned and you should get the existing link from this error object (not as a regular response).

 


@Esikhoob wrote:

...

What is root namespace?

...


For more info how Business/Team files are organized (if you're using such) take a look here.

Alternatively, if correct file path is problem for you, files/folders id can be used (as can be seen in the error's regular expression - '\A(?:(/(.|[\r\n])*|id:.*)|(rev:[0-9a-f]{9,})|(ns:[0-9]+(/.*)?))\z'. If you're able to see particular file in a file list (using 'ListFolderAsync(path);'), you already have its id, just use it as is. It identifies file/folder in a unique way and is valid while this file or folder exists.

Hope this clarifies matter.

Esikhoob
Helpful | Level 5
Go to solution

Hi

Thank you very much

I finally found the solution. The problem  was that I don`t understand the difference between account which the App is created by and the user which do login to Oath2 page (connected account).  

If I want to have access to the files in the App folder that I have created in my account, I should enter it`s user name and password in the oath2 page. I thought "app secret" and "app key" is enough to show us files in the app folder, which was wrong.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Esikhoob Helpful | Level 5
  • User avatar
    Здравко Legendary | Level 20
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?