Dropbox API Getting a shared link for a file or folder Creating a shared link for a file using the Dropbox Java library

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

This uses the Dropbox Java SDK to create a shared link for a file at the Dropbox path /test.txt:

try {
    SharedLinkMetadata sharedLinkMetadata = client.sharing().createSharedLinkWithSettings("/test.txt");
    System.out.println(sharedLinkMetadata.getUrl());
} catch (CreateSharedLinkWithSettingsErrorException ex) {
    System.out.println(ex);
} catch (DbxException ex) {
    System.out.println(ex);
}

This assumes client is a pre-existing and authorized DbxClientV2 object, and does some basic exception handling to print the output.



Got any Dropbox API Question?