cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements
In need of some #MondayMotivation? Read more

get shared Link of Uploaded Folder

SOLVED
93 Views
2 Comments
0 Kudos
Highlighted
Level 2

get shared Link of Uploaded Folder

Hi,

 

I can upload my files with:

 

	public void uploadFileToDropbox(File inputFile, String path, String fileName) throws Exception{
		InputStream inputStream = new FileInputStream(inputFile);
		try {
		    FileMetadata uploadedFile = client.files().uploadBuilder("/"+path+"/"+fileName).uploadAndFinish(inputStream);
		    System.out.println("Uploaded to Dropbox: " + uploadedFile.getName());
		} finally {
		    inputStream.close();
		}
	}

How can I get the URL of the folder? I tried this:

 

	public String getShareLink(String path) throws DbxException{
		SharedLinkMetadata slm = client.sharing().createSharedLinkWithSettings(path);
		return(slm.getUrl());
	}

But I always get:

 

java.lang.IllegalArgumentException: String 'path' does not match pattern
1 Accepted solution

Accepted Solutions
Solution
Level 2

Betreff: get shared Link of Uploaded Folder

Changed the URL Line like that:

 

SharedLinkMetadata slm = client.sharing().createSharedLinkWithSettings("/"+path);
2 Replies
Solution
Level 2

Betreff: get shared Link of Uploaded Folder

Changed the URL Line like that:

 

SharedLinkMetadata slm = client.sharing().createSharedLinkWithSettings("/"+path);
Dropboxer

Betreff: get shared Link of Uploaded Folder

I'm glad to hear you already sorted this out. That's correct, non-root file paths need a leading '/'.