We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
kir_ko
5 years agoHelpful | Level 5
Shared link metadata object returns incorrect IsPassword in dropbox-sdk-dotnet
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!
8 Replies
Replies have been turned off for this discussion
- Greg-DB5 years ago
Dropbox Community Moderator
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!
- kir_ko5 years agoHelpful | Level 5
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.
- kylea5 years ago
Dropbox Staff
Just to confirm:
- The property is true when you executed the HTTPS call (in the Dropbox API explorer or other), but the property is returning false in the SDK?
- Including the line to LinkPermissionsDecoder resolved?
- kir_ko5 years agoHelpful | Level 5
- The property is true when you executed the HTTPS call (in the Dropbox API explorer or other), but the property is returning false in the SDK? - Yes, Sir.
- Including the line to LinkPermissionsDecoder resolved? - Sorry, the question is not clear for me. If you mean including the line to my local copy of dropbox-sdk-dotnet is a solution then the answer is no, forking each sdk release in local repo seems like a wrong idea -)
- kylea5 years ago
Dropbox Staff
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.
- kir_ko5 years agoHelpful | Level 5
Ah, OK, got it. So yep, those lines worked fine and returned 'true' I was searching for 😉
- Greg-DB5 years ago
Dropbox Community Moderator
kir_ko These properties, such as LinkPermissions.RequirePassword, should now be available in the SDK as of v6.10.2.
- kir_ko5 years agoHelpful | Level 5
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.
About 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!