cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and 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: 

Right way to create shared link with password? (C#, .NET, ApiV2)

Right way to create shared link with password? (C#, .NET, ApiV2)

DropUser
Explorer | Level 4
Go to solution

I'm using following combo: C#, .NET, ApiV2

 

What's the right way to create shared link with password?

 

Tried:

Console.WriteLine("----- shareFile function starts -----");
RequestedVisibility visibility = (password == null ? null : new RequestedVisibility().AsPassword);
DateTime date = DateTime.Now.AddDays(7 * dueInWeeks);
var sharedLinkSettings = new SharedLinkSettings(visibility, password, date);
var overAllSettings = new CreateSharedLinkWithSettingsArg(path, sharedLinkSettings);
try
{
  Console.WriteLine("Sharing \"" + path + "\" file starts");
  var shared = await client.Sharing.CreateSharedLinkWithSettingsAsync(overAllSettings);
  Console.WriteLine("----- shareFile function ends -----");
  return shared;
}

 

But gives error:

Exception thrown: 'Dropbox.Api.ApiException`1' in mscorlib.dll
Exception: Dropbox.Api.ApiException`1[Dropbox.Api.Sharing.CreateSharedLinkWithSettingsError]: settings_error/invalid_settings/...

 

Not sure about RequestedVisibility thing..

 

Everything works well without password related parameters.

 

Quick working example would be very appreciated!

 

 

Thanks

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution
It looks like you just need to use `RequestedVisibility.Password.Instance` instead of `new RequestedVisibility().AsPassword`.

Try that out and let me know if it doesn't help.

View solution in original post

2 Replies 2

Greg-DB
Dropbox Staff
Go to solution
It looks like you just need to use `RequestedVisibility.Password.Instance` instead of `new RequestedVisibility().AsPassword`.

Try that out and let me know if it doesn't help.

DropUser
Explorer | Level 4
Go to solution
Ah, I was blind that I didn't notice that at the first place. It works. Thanks!
Need more support?
Who's talking

Top contributors to this post

  • User avatar
    DropUser Explorer | Level 4
  • User avatar
    Greg-DB Dropbox Staff
What do Dropbox user levels mean?