Awesome
Dropbox Sample Apps
<a href="https://githubsfdeploy.herokuapp.com?owner=financialforcedev&repo=ffhttp-dropbox-samples"> <img alt="Deploy to Salesforce" src="https://raw.githubusercontent.com/afawcett/githubsfdeploy/master/src/main/webapp/resources/img/deploy.png"> </a>Summary
This app (or collection of apps) has been built to demonstrate the use of the Dropbox and Core libraries.
It consists of two components:
- A test harness that provides a UI for performing all of the Dropbox API calls.
- An implementation of the library that allows Account attachments to be transferred to Dropbox.
Note: Currently, no test coverage for the sample apps has been provided.
Key Features
- Demonstrates each of the API calls found at https://www.dropbox.com/developers/core/docs.
- Demonstrates the use of the /files_put API call by transferring an Account attachment to Dropbox.
- Demonstrates the use of the /shares API call by sharing the transferred file to all the Account contacts.
- Demonstrates the use of the /fileops/delete API call by deleting the file from Dropbox.
Configuration
This section explains how to configure the Dropbox Sample Apps.
- Deploy the Core package to your Salesforce organisation.
- Deploy the OAuth Sample App.
- Deploy the Dropbox package.
- Deploy the Dropbox Sample App.
- Go to Setup > Manage Users > Users.
- Select your user.
- Select Edit Assignments in the Permission Set Assignments section.
- Add the OAuth Sample App Permissions and Dropbox Sample App Permissions permission sets and Save.
- Select the Dropbox Sample App from the app menu.
- The Test Harness, Account, Connector Types and Connectors tabs should be displayed.
- Create a Dropbox App following the steps in the Create an app in Dropbox section below.
- Follow the steps in the Create a Dropbox Connector section below.
- Go to Setup > Customize > Accounts > Page Layouts.
- Select Edit on the Account Layout.
- Select the Buttons section.
- Add the Move Attachments to Dropbox button to the Custom Buttons section.
- Save the layout.
- Select an account from the Accounts tab.
- The Move Attachments to Dropbox button should be displayed.
###Create an app in Dropbox
- Log in to your Dropbox account.
- Go to https://www.dropbox.com/developers/apps and select Create App.
- Select Dropbox API app for What type of data does your app need to store on Dropbox?.
- Select Files and datastores for Can your app be limited to its own folder?.
- Select No as Can your app be limited to its own folder?.
- Select All file types for What type of files does your app need access to?.
- Enter an App name and select Create App.
- Set the Redirect URIs to the URL of the Salesforce organisation e.g. https://eu3.salesforce.com/apex/conector.
- Make sure you know the App Key and App Secret as they will be needed later.
###Create a Dropbox Connector
-
Log in to your Salesforce organisation.
-
Go to the Developer Console and select Debug > Open Execute Anonymous Window.
-
Run the following code changing the parameters to the appropriate values:
DropboxConfigure.configure(<App Key>, <App Secret>, <Salesforce domain>);
-
Check that the connector has been created and activate it.
Use
Once the project is configured:
###Test Harness
- Select the Test Harness tab.
- Check that you get a message starting with 'Successful authentication'. If you do not, check that all the configuration steps have been peformed correctly.
- Expand any section to display the API calls, then select Submit to test the call.
###Account Transfer Sample App
- Select the Accounts tab and view an account.
- In the Notes & Attachments section select Attach File. Choose a file and attach it.
- Select the Move Attachments to Dropbox button.
- Choose an attachment and select Transfer.
- The attachment will have been transferred to Dropbox.
Reporting Issues & Enhancements
Please report any issues using the github issues feature. Suggestions / bug reports are welcome as are extensions containing additional functionality.