List & Label and Dropbox

Valid from List & Label 17

With List & Label it is possible to export reports directly to your Dropbox folder. Just a few changes to existing code are required in order to achieve this functionality. The easiest way to implement this is by using a .NET library, which can be downloaded and used for free using the provided hyperlink. There are two assemblies in the downloaded archive. Choose AppLimit.CloudComputing.SharpBox.dll if your List & Label project targets .NET Framework 3.5 or AppLimit.CloudComputing.SharpBox.Net40.dll if your project targets .NET Framework 4.0 or higher. Please add the chosen dll as a reference to your existing List & Label application and use the following sample code afterwards.

using (ListLabel ll = new ListLabel())
    ll.DataSource = CreateDataSet();
    // Export report to a stream
    MemoryStream exportStream = new MemoryStream();
    ExportConfiguration exportConfiguration = new ExportConfiguration(LlExportTarget.Pdf, exportStream, "simple.lst");
    // Create credential object
    DropBoxCredentials dropBoxCredentials = new DropBoxCredentials();
    // Add application keys
    dropBoxCredentials.ConsumerKey = "YourConsumerKey";
    dropBoxCredentials.ConsumerSecret = "YourConsumerSecrect";
    // Add user (usually your eMail) and password
    dropBoxCredentials.UserName = "YourUserName";
    dropBoxCredentials.Password = "YourPassword";
    // Create standard config
    DropBoxConfiguration dropBoxConfiguration = DropBoxConfiguration.GetStandardConfiguration();
    // Create cloud storage
    CloudStorage cloudStorage = new CloudStorage();
    // Open connection
    cloudStorage.Open(dropBoxConfiguration, dropBoxCredentials);
    // Upload file
    exportConfiguration.ExportStream.Seek(0, SeekOrigin.Begin);
    cloudStorage.UploadFile(exportConfiguration.ExportStream, "export.pdf", cloudStorage.GetRoot());
    if (cloudStorage.IsOpened)

In order to aquire your own ConsumerKey and ConsumerSecret you have to create an App under Dropbox - Create app. After you received them, simply replace YourConsumerKey and YourConsumerSecrect with real values. YourUserName and YourPassword must be replaced with real login data as well.


Related articles:

IDKBTE000859 KBTE000859