<?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: Files are no longer uploaded to Dropbox from PowerShell script in Dropbox API Support &amp; Feedback</title>
    <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Files-are-no-longer-uploaded-to-Dropbox-from-PowerShell-script/m-p/593499#M27611</link>
    <description>&lt;P&gt;Can you elaborate on what you mean when you say "the PCs are running TLS 1.2"? Can you check if 'Invoke-RestMethod' in particular is using TLS 1.2 for these network requests?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Dropbox API servers do currently only support TLS 1.2, so it would be fine to enable only TLS 1.2 client-side for this as far as the Dropbox API calls are concerned. Network clients should automatically use the best available version though, so that shouldn't be necessary anyway.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In any case, this is the right forum for help with the Dropbox API. You can also &lt;A href="https://www.dropbox.com/developers/contact" target="_self"&gt;open an API ticket here&lt;/A&gt; if you'd prefer to communicate privately.&lt;/P&gt;</description>
    <pubDate>Tue, 26 Apr 2022 17:54:52 GMT</pubDate>
    <dc:creator>Greg-DB</dc:creator>
    <dc:date>2022-04-26T17:54:52Z</dc:date>
    <item>
      <title>Files are no longer uploaded to Dropbox from PowerShell script</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Files-are-no-longer-uploaded-to-Dropbox-from-PowerShell-script/m-p/592778#M27578</link>
      <description>&lt;P&gt;Hi everyone!&lt;/P&gt;
&lt;P&gt;Hope you can help me out with this one:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;We have a VOIP provider which stores calls for a maximum of 30 days, hence, we download them and upload the .wav files to Dropbox so we can have them forever stored.&lt;/P&gt;
&lt;P&gt;Until a few days ago, we used the following script to automate the process, HOWEVER, now the calls are downloaded, folders are created on Dropbox, but the files are not uploaded. Did you guys change something in the API or is there something missing now in the code?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;function Upload-FileToDropbox {&lt;/P&gt;
&lt;P&gt;Param(&lt;BR /&gt;[Parameter(Mandatory=$true)]&lt;BR /&gt;[string]$SourceFilePath,&lt;BR /&gt;[Parameter(Mandatory=$true)]&lt;BR /&gt;[string]$TargetFilePath,&lt;BR /&gt;[Parameter(Mandatory=$true)]&lt;BR /&gt;[string]$DropBoxAccessToken&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;$arg = '{ "path": "' + $TargetFilePath + '", "mode": "add", "autorename": true, "mute": false }'&lt;BR /&gt;$authorization = "Bearer $DropBoxAccessToken"&lt;/P&gt;
&lt;P&gt;$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"&lt;BR /&gt;$headers.Add("Authorization", $authorization)&lt;BR /&gt;$headers.Add("Dropbox-API-Arg", $arg)&lt;BR /&gt;$headers.Add("Content-Type", 'application/octet-stream')&lt;BR /&gt;&lt;BR /&gt;Write-Verbose "Uploading file: $SourceFilePath"&lt;BR /&gt;try {&lt;BR /&gt;Invoke-RestMethod -Uri &lt;A href="https://content.dropboxapi.com/2/files/upload" target="_blank" rel="noopener"&gt;https://content.dropboxapi.com/2/files/upload&lt;/A&gt; -Method Post -InFile $SourceFilePath -Headers $headers&lt;BR /&gt;}&lt;BR /&gt;catch {&lt;BR /&gt;Write-Error $_.Message&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;function Create-FolderInDropbox {&lt;/P&gt;
&lt;P&gt;Param(&lt;BR /&gt;[Parameter(Mandatory=$true)]&lt;BR /&gt;[string]$FolderPath,&lt;BR /&gt;[Parameter(Mandatory=$true)]&lt;BR /&gt;[string]$DropBoxAccessToken&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;$JSONBody = @{ "path"=$FolderPath; "autorename"=$false} | ConvertTo-Json&lt;BR /&gt;$authorization = "Bearer $DropBoxAccessToken"&lt;/P&gt;
&lt;P&gt;$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]"&lt;BR /&gt;$headers.Add("Authorization", $authorization)&lt;BR /&gt;$headers.Add("Content-Type", 'application/json')&lt;BR /&gt;&lt;BR /&gt;Write-Verbose "Creating folder: $FolderPath"&lt;BR /&gt;Invoke-RestMethod -Uri &lt;A href="https://api.dropboxapi.com/2/files/create_folder_v2" target="_blank" rel="noopener"&gt;https://api.dropboxapi.com/2/files/create_folder_v2&lt;/A&gt; -Method Post -Headers $headers -Body $JSONBody&lt;BR /&gt;Write-Error $_.Message&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;function Rename-WaveFile {&lt;BR /&gt;Param(&lt;BR /&gt;[Parameter(Mandatory=$true)]&lt;BR /&gt;[System.IO.FileSystemInfo]$File&lt;BR /&gt;)&lt;BR /&gt;$XMLFile = [xml](Get-Content ($File.Fullname).Replace(".wav", ".xml"))&lt;BR /&gt;$StartDate = [DateTime]::Parse($XMLFile.Recording.start).ToString("yyyyMMdd-hh.mm.ss")&lt;BR /&gt;$AgentID = $XMLFile.Recording.userid&lt;BR /&gt;$FileID = $File.BaseName&lt;BR /&gt;$NewFileName = "$FileID-$StartDate-$AgentID.wav"&lt;BR /&gt;&lt;BR /&gt;Write-Verbose "Renaming $($File.Name) to $NewFileName"&lt;BR /&gt;$NewFile = Rename-Item -Path $File.Fullname -NewName $NewFileName -Confirm:$false -Force -PassThru&lt;BR /&gt;return $NewFile&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;#Confidential credentials&lt;BR /&gt;$DropboxAccessToken = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"&lt;BR /&gt;$User = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"&lt;BR /&gt;$Password ="xxxxxxxxxx"&lt;BR /&gt;$ScriptPath = Split-Path -Parent $MyInvocation.MyCommand.Definition&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;#Declare variables&lt;BR /&gt;$DownloaderExe = "C:\FuzeDownloader\RecordingsDownloader\RecordingsDownloader.exe"&lt;BR /&gt;#$Today = (Get-Date).ToString("yyyy-MM-dd")&lt;BR /&gt;$Today = "2022-04-21"&lt;BR /&gt;$DropboxFolderPath = "/FuzeRecordings/$Today"&lt;BR /&gt;$WavPath = "C:\FuzeDownloader\RecordingsDownloader\RecordingsDownloaderOutput\"&lt;BR /&gt;$numbers = 0&lt;/P&gt;
&lt;P&gt;#Download Wav files&lt;BR /&gt;Push-Location $ScriptPath&lt;BR /&gt;$DownloaderProc = Start-Process -FilePath $DownloaderExe -ArgumentList "-d$Today -u$User -p$Password" -PassThru -NoNewWindow&lt;BR /&gt;while (Get-Process -Id $DownloaderProc.Id) {&lt;BR /&gt;if ($(Get-Date) -gt $DownloaderProc.StartTime.AddHours(8)) {&lt;BR /&gt;Write-Error -Message "Script has been running for over 8 hours. Something's wrong."&lt;BR /&gt;exit 666&lt;BR /&gt;}&lt;BR /&gt;Start-Sleep -Seconds 5&lt;BR /&gt;}&lt;/P&gt;
&lt;P&gt;#Create Folder for today's calls&lt;BR /&gt;Create-FolderInDropbox -FolderPath $DropboxFolderPath -DropBoxAccessToken $DropboxAccessToken&lt;/P&gt;
&lt;P&gt;$WavFiles = Get-ChildItem -Path $WavPath -Include "*.wav" -Recurse&lt;BR /&gt;foreach ($Wav in $WavFiles) {&lt;BR /&gt;#Rename Wave files to show date, time and user name&lt;BR /&gt;$RenamedFile = Rename-WaveFile $Wav&lt;BR /&gt;&lt;BR /&gt;#Once renamed, upload it to Dropbox&lt;BR /&gt;Upload-FileToDropbox -SourceFilePath $RenamedFile.FullName -TargetFilePath "$DropboxFolderPath/$($RenamedFile.Name)" -DropBoxAccessToken $DropboxAccessToken&lt;BR /&gt;$numbers++&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;------------------------------------------------------------------------&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I've replaced access token and credentials with "xxxxxxx"&lt;/P&gt;
&lt;P&gt;No error message is thrown on the output.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance for the help!&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 11:18:02 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Files-are-no-longer-uploaded-to-Dropbox-from-PowerShell-script/m-p/592778#M27578</guid>
      <dc:creator>alenavarro</dc:creator>
      <dc:date>2022-04-26T11:18:02Z</dc:date>
    </item>
    <item>
      <title>Re: Files are no longer uploaded to Dropbox from PowerShell script</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Files-are-no-longer-uploaded-to-Dropbox-from-PowerShell-script/m-p/592787#M27580</link>
      <description>&lt;P&gt;Whenever you make an API call, such as to /2/files/upload like in this code, you would either get a response from the API (such as the result or some API error), or some error from your network client if the connection failed. I understand you're not getting an error message in the output, so you may need to debug this or refer to the documentation for your platform for information on how to access the error, e.g., when using 'Invoke-RestMethod'. That's not made by Dropbox though so I can't offer help with that specifically.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Based on the description and timing though, &lt;SPAN class=" author-d-42z69zz85zx9z84zz79zvz66zz71z4yz65zz67znhz79zc7fz89zz67z5z82zikmz70zz75ztz72zz83zuyz68zz122zz69z9z122zz122zv35e"&gt;this may be due to a recent change to our TLS configuration. Dropbox recently retired support for TLS 1.0 and 1.1. The Dropbox API servers now only support connections using TLS 1.2. You'll need to update your app/network client/environment to use TLS 1.2 in order to continue making Dropbox API calls.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 22 Apr 2022 19:01:05 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Files-are-no-longer-uploaded-to-Dropbox-from-PowerShell-script/m-p/592787#M27580</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2022-04-22T19:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: Files are no longer uploaded to Dropbox from PowerShell script</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Files-are-no-longer-uploaded-to-Dropbox-from-PowerShell-script/m-p/593450#M27606</link>
      <description>&lt;P&gt;Thanks for the answer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was able to debug a bit, here's the error I get:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="586f2b97-795b-4457-b2a7-a19c8116defc.jpg" style="width: 800px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/28999i84188AAF4D1426CC/image-size/large?v=v2&amp;amp;px=999" role="button" title="586f2b97-795b-4457-b2a7-a19c8116defc.jpg" alt="586f2b97-795b-4457-b2a7-a19c8116defc.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;This is indeed an error with &lt;STRONG&gt;Upload-FileToDropbox&lt;/STRONG&gt; function...and it looks like a WriteErrorException&lt;/P&gt;&lt;P&gt;Weird, as stated before, the script ran for almost two years without any changes made to it....&lt;/P&gt;&lt;P&gt;We tried running it on a different PC, with most of the updates for the OS (TLS), but still the same....&lt;/P&gt;&lt;P&gt;Any other ideas we might try? @Greg-DB&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 16:18:08 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Files-are-no-longer-uploaded-to-Dropbox-from-PowerShell-script/m-p/593450#M27606</guid>
      <dc:creator>alenavarro</dc:creator>
      <dc:date>2022-04-26T16:18:08Z</dc:date>
    </item>
    <item>
      <title>Re: Files are no longer uploaded to Dropbox from PowerShell script</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Files-are-no-longer-uploaded-to-Dropbox-from-PowerShell-script/m-p/593485#M27609</link>
      <description>&lt;P&gt;The 'Microsoft.PowerShell.Commands.WriteErrorException' error type isn't made by Dropbox, so I can't offer too much insight on that. If a Dropbox API call fails, the Dropbox API would return a response body, but I don't see one here.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do still expect this is related to the TLS change though, so I recommend looking into making sure your environment uses TLS 1.2. (In the case of a TLS failure, that would be a failure of the actual network connection and so would fail before the Dropbox API call occurs, meaning there wouldn't be an error message from the Dropbox API itself.)&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 17:28:32 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Files-are-no-longer-uploaded-to-Dropbox-from-PowerShell-script/m-p/593485#M27609</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2022-04-26T17:28:32Z</dc:date>
    </item>
    <item>
      <title>Re: Files are no longer uploaded to Dropbox from PowerShell script</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Files-are-no-longer-uploaded-to-Dropbox-from-PowerShell-script/m-p/593487#M27610</link>
      <description>&lt;P&gt;Well, I double checked and the PCs are running TLS 1.2&lt;/P&gt;&lt;P&gt;Should I just check that protocol and disable all others? I don't think that would be recommended&lt;/P&gt;&lt;P&gt;Also, where else can I ask about this?&lt;/P&gt;&lt;P&gt;I'm still insisting that the script worked for TWO YEARS and just a few days ago stopped working...&lt;/P&gt;&lt;P&gt;So if it isn't related to TLS, what else can it be?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 17:39:07 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Files-are-no-longer-uploaded-to-Dropbox-from-PowerShell-script/m-p/593487#M27610</guid>
      <dc:creator>alenavarro</dc:creator>
      <dc:date>2022-04-26T17:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: Files are no longer uploaded to Dropbox from PowerShell script</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Files-are-no-longer-uploaded-to-Dropbox-from-PowerShell-script/m-p/593499#M27611</link>
      <description>&lt;P&gt;Can you elaborate on what you mean when you say "the PCs are running TLS 1.2"? Can you check if 'Invoke-RestMethod' in particular is using TLS 1.2 for these network requests?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The Dropbox API servers do currently only support TLS 1.2, so it would be fine to enable only TLS 1.2 client-side for this as far as the Dropbox API calls are concerned. Network clients should automatically use the best available version though, so that shouldn't be necessary anyway.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In any case, this is the right forum for help with the Dropbox API. You can also &lt;A href="https://www.dropbox.com/developers/contact" target="_self"&gt;open an API ticket here&lt;/A&gt; if you'd prefer to communicate privately.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 17:54:52 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Files-are-no-longer-uploaded-to-Dropbox-from-PowerShell-script/m-p/593499#M27611</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2022-04-26T17:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: Files are no longer uploaded to Dropbox from PowerShell script</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Files-are-no-longer-uploaded-to-Dropbox-from-PowerShell-script/m-p/593515#M27612</link>
      <description>&lt;P&gt;This is what I mean by that:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="TLS.jpg" style="width: 280px;"&gt;&lt;img src="https://www.dropboxforum.com/t5/image/serverpage/image-id/29010i8E77D22889F26FB7/image-dimensions/280x382?v=v2" width="280" height="382" role="button" title="TLS.jpg" alt="TLS.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;How do I check if Invoke-RestMethod is using TLS 1.2?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 18:31:59 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Files-are-no-longer-uploaded-to-Dropbox-from-PowerShell-script/m-p/593515#M27612</guid>
      <dc:creator>alenavarro</dc:creator>
      <dc:date>2022-04-26T18:31:59Z</dc:date>
    </item>
    <item>
      <title>Re: Files are no longer uploaded to Dropbox from PowerShell script</title>
      <link>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Files-are-no-longer-uploaded-to-Dropbox-from-PowerShell-script/m-p/593527#M27613</link>
      <description>&lt;P&gt;It's not clear if those settings mean that Invoke-RestMethod will use TLS 1.2. I can't offer help specifically for Invoke-RestMethod as it's not made by Dropbox, so I recommend referring to its documentation for information on configuring it.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Apr 2022 19:10:16 GMT</pubDate>
      <guid>https://www.dropboxforum.com/t5/Dropbox-API-Support-Feedback/Files-are-no-longer-uploaded-to-Dropbox-from-PowerShell-script/m-p/593527#M27613</guid>
      <dc:creator>Greg-DB</dc:creator>
      <dc:date>2022-04-26T19:10:16Z</dc:date>
    </item>
  </channel>
</rss>

