Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Got a file shared via view/edit link for anyone/team with password. In API explorer I call the 'get_shared_link_metadata' for the file and clearly see the raw response has all the properties correct including the 'link_permissions.require_password' one (true in my case). But retrieving the link metadata using dropbox-sdk-dotnet for the same file I face the fact that Sharing.FileLinkMetadata.LinkPermissions object returns false for any *password* property. I think that at least the LinkPermissions.EffectiveAudience.IsPassword property is supposed to be true. Also not really clear for me why the LinkPermissions.EffectiveAudience object doesn't contain the IsTeamAndPassword property while LinkPermissions.ResolvedVisibility does? Thanks!
Could you share the relevant code you're using and output you're getting so we can look at what you're seeing specifically? Thanks in advance!
Thanks for the response! Sure, there it is step-by-step:
1) The .paper file shared for team members with password required
2)
namespace PatchTest
{
using Dropbox.Api;
using Dropbox.Api.Common;
using System;
class Program
{
static void Main(string[] args)
{
var link = @"https://www.dropbox.com/_cut_/public_paper_team_members_with_password_can_edit.paper?dl=0&rlkey=_cut_";
var namespaceId = "_cut_";
var memberId = "_cut_";
var accessToken = "_cut_";
var config = new DropboxClientConfig("");
var teamClient = new DropboxTeamClient(accessToken, config);
var userClient = teamClient.AsMember(memberId).WithPathRoot(new PathRoot.NamespaceId(namespaceId));
var sharedLinkMetadata = userClient.Sharing.GetSharedLinkMetadataAsync(link).Result;
Console.ReadKey();
}
}
}
3) And what we get as a result (IsTeam resolved properly while IsPassword is incorrect):
The LinkPermissions.RequirePassword==true property you can see on the screenshot is an example that the proper value can be found. I added the property to Dropbox.Api.Sharing.LinkPermissions class and added another switch to the LinkPermissionsDecoder.SetField method:
private class LinkPermissionsDecoder : enc.StructDecoder<LinkPermissions>
{
...
protected override void SetField(LinkPermissions value, string fieldName, enc.IJsonReader reader)
{
switch (fieldName)
{
case "require_password":
value.RequirePassword = enc.BooleanDecoder.Instance.Decode(reader);
break;
case "can_revoke":
value.CanRevoke = enc.BooleanDecoder.Instance.Decode(reader);
break;
case "resolved_visibility":
...
Thanks.
Just to confirm:
I'm not suggesting forking the SDK is a sustainable solution; I'm just confirming if the lines you added worked 😀. I'll be tracking it as a bug in the SDK.
Ah, OK, got it. So yep, those lines worked fine and returned 'true' I was searching for 😉
@kir_ko These properties, such as LinkPermissions.RequirePassword, should now be available in the SDK as of v6.10.2.
@Greg-DB Thanks a lot! After July 19th I'll download the 6.10.2 version and update my methods accordingly. Will update the discussion when done.
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
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!