Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
DropUser
8 years agoExplorer | Level 4
Right way to create shared link with password? (C#, .NET, ApiV2)
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
- 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.
2 Replies
- Greg-DB8 years ago
Dropbox Community Moderator
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. - DropUser8 years agoExplorer | Level 4Ah, I was blind that I didn't notice that at the first place. It works. Thanks!
About 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!