<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Dropbox API .NET SDK: Modifying shared link password issues. in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-NET-SDK-Modifying-shared-link-password-issues/m-p/541421#M25959</link>
    <description>&lt;P&gt;When setting options like this, you should use the provided instance, like this:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;var visibility = RequestedVisibility.Public.Instance;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, I see you're checking the "RequestedVisibility" in the result, but you probably want to actually check "ResolvedVisibility", since that's what tells you what the final state actually is (e.g., once team policies were taken into account as well).&lt;/P&gt;</description>
    <pubDate>Thu, 26 Aug 2021 15:26:08 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2021-08-26T15:26:08Z</dc:date>
    <item>
      <title>Dropbox API .NET SDK: Modifying shared link password issues.</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-NET-SDK-Modifying-shared-link-password-issues/m-p/541282#M25957</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Seems that there's an issue in the SDK with modifying shared link settings. I am using Dropbox.Api Nuget V6.13.0. with an Admin-accessed internal app. I am able to set up passwords on client folders, but I am unable to remove passwords on those folders through the API. To expand, the SetLinkPassword() method successfully processes and changes the link status to password. However, the RemoveLinkPassword() method successfully process, but does not remove the password.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here's the code in C#.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;// This is the NUnit test. client.DropboxSharedURL is the URL to the client's folder, which they have View access to.

[Fact]
        public async Task SetSamplePassword()
        {
            var clients = Clients.Read();
            var client = clients[1000];
            string password = "testpassword";

            await Password.SetLinkPassword(client.DropboxSharedURL, password);
            Assert.Equal(true, await Password.HasPassword(client.DropboxSharedURL));

            await Password.RemoveLinkPassword(client.DropboxSharedURL);
            Assert.Equal(false, await Password.HasPassword(client.DropboxSharedURL));

        }&lt;/LI-CODE&gt;&lt;LI-CODE lang="csharp"&gt; //These are the two methods I am using to set/reset the Link password.

public static async Task SetLinkPassword(string url, string password)
        {
            var accesslevel = new RequestedLinkAccessLevel().AsViewer;
            var audience = new LinkAudience().AsPassword;
            var sharedlinksettings = new SharedLinkSettings(true, password, null, audience, accesslevel, null, true);

            await user.Sharing.ModifySharedLinkSettingsAsync(url, sharedlinksettings, false);
        }

public static async Task RemoveLinkPassword(string url)
        {
            var accesslevel = new RequestedLinkAccessLevel().AsViewer;
            var audience = new LinkAudience().AsPublic;
            var visibility = new RequestedVisibility().AsPublic;
            var sharedlinksettings = new SharedLinkSettings(false, null, null, audience, accesslevel, visibility);

            await user.Sharing.ModifySharedLinkSettingsAsync(url, sharedlinksettings, false);
        }&lt;/LI-CODE&gt;&lt;LI-CODE lang="csharp"&gt;//This checks if a link has a password.
public static async Task&amp;lt;bool?&amp;gt; HasPassword(string url)
        {
            try
            {
                var metadata = await user.Sharing.GetSharedLinkMetadataAsync(url);
                return metadata.LinkPermissions.RequestedVisibility.IsPassword;
            }
            catch
            {
                return null;
            }

        }&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 18:34:58 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-NET-SDK-Modifying-shared-link-password-issues/m-p/541282#M25957</guid>
      <dc:creator>AGreenTejada</dc:creator>
      <dc:date>2021-08-26T18:34:58Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API .NET SDK: Modifying shared link password issues.</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-NET-SDK-Modifying-shared-link-password-issues/m-p/541421#M25959</link>
      <description>&lt;P&gt;When setting options like this, you should use the provided instance, like this:&lt;/P&gt;
&lt;LI-CODE lang="csharp"&gt;var visibility = RequestedVisibility.Public.Instance;&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, I see you're checking the "RequestedVisibility" in the result, but you probably want to actually check "ResolvedVisibility", since that's what tells you what the final state actually is (e.g., once team policies were taken into account as well).&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 15:26:08 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-NET-SDK-Modifying-shared-link-password-issues/m-p/541421#M25959</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2021-08-26T15:26:08Z</dc:date>
    </item>
    <item>
      <title>Re: Dropbox API .NET SDK: Modifying shared link password issues.</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-NET-SDK-Modifying-shared-link-password-issues/m-p/541493#M25960</link>
      <description>&lt;P&gt;Awesome, that just worked. I'm a little uncomfortable dealing with static initializers instead of constructors, but our team will refactor as necessary.&lt;/P&gt;</description>
      <pubDate>Thu, 26 Aug 2021 20:02:05 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Dropbox-API-NET-SDK-Modifying-shared-link-password-issues/m-p/541493#M25960</guid>
      <dc:creator>AGreenTejada</dc:creator>
      <dc:date>2021-08-26T20:02:05Z</dc:date>
    </item>
  </channel>
</rss>

