When I migrated our build to Cake (C# Make) we had one requirement which was to upload some of the build output’s artifacts to DropBox at the end of the build.

I searched for that kind of capabilities in Cake reference documentation but couldn’t find anything out of the box.

I could have gone to write my own add-in but I found the PowerShell one, great!
So I decided that I could write a little PowerShell script to achieve that upload to DropBox.

Here it is

The script is getting one environment variable DropBoxAccessToken, which represents the DropBox access token because I don’t want to see the access token logged into our TeamCity logs.

One gotcha from DropBox REST API upload documentation which hit me was how to upload to a business account? In fact, it is really easy, you just need to create an application for your business account with permission full!

Warning, I do not consider myself as a PowerShell expert, I am more of a kind of PowerShell hacker, so take this script with all precautions.