We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
thanasis k.
11 years agoNew member | Level 1
create a folder that will be shared and add a member to it
iam using the code below in a java desktop application, in order to create a folder in a dropbox account that i want to be shared, and i am trying to add another member by his email address, but iam getting:
java.lang.NoSuchMethodError: com.dropbox.core.json.JsonWriter.writeFields(Ljava/lang/Object;Lcom/fasterxml/jackson/core/JsonGenerator;)V
at com.dropbox.core.v2.DbxFiles$CreateFolderArg$1.write(DbxFiles.java:5337)
at com.dropbox.core.v2.DbxFiles$CreateFolderArg$1.write(DbxFiles.java:5332)
at com.dropbox.core.json.JsonWriter.writeToStream(JsonWriter.java:23)
at com.dropbox.core.json.JsonWriter.writeToStream(JsonWriter.java:33)
at com.dropbox.core.v2.DbxRawClientV2.rpcStyle(DbxRawClientV2.java:82)
at com.dropbox.core.v2.DbxFiles.createFolder(DbxFiles.java:8459)
at com.dropbox.core.v2.DbxFiles.createFolder(DbxFiles.java:8479)
my code is the following:
DbxRequestConfig dbxRequestConfig = new DbxRequestConfig("test/1.0", Locale.getDefault().toString());
DbxClientV2 dbxClient = new DbxClientV2(dbxRequestConfig, my_access_token);
FolderMetadata md = dbxClient.files.createFolder("/test");
ArrayList<AddMember> list = new ArrayList();
DbxSharing.AddMember a1 = new DbxSharing.AddMember(DbxSharing.MemberSelector.email("xxxxxx@gmail.com"),DbxSharing.AccessLevel.editor);
list.add(a1);
dbxClient.sharing.addFolderMember(md.parentSharedFolderId, list);
i have already search for any solution to create a shared folder and add a member to it, but iam not finding anything useful to my case.
Could anyone tell me what iam doing wrong??please help me ASAP.
14 Replies
Replies have been turned off for this discussion
- Greg-DB11 years ago
Dropbox Community Moderator
[Cross-linking for reference: https://stackoverflow.com/questions/34300511/create-a-shared-folder-in-dropbox-with-dropbox-core-sdk-2-0-beta-4-and-then-add ]
I can't seem to reproduce that error. What version of the SDK do you have and how are you building/running this?
- thanasis k.11 years agoNew member | Level 1
iam using the dropbox-core-sdk-2.0-beta-4.jar
- thanasis k.11 years agoNew member | Level 1
my code hits at the line:
FolderMetadata md = dbxClient.files.createFolder("/test");
- Greg-DB11 years ago
Dropbox Community Moderator
How are you building and running? Are you using Maven as recommended in the installation instructions?
https://www.dropbox.com/developers/documentation/java#installf
- thanasis k.11 years agoNew member | Level 1
iam not using MAVEN,
my code runs inside a java desktop application on which i have include the external libraries:
dropbox-core-sdk-2.0-beta-4.jar
and
jackson-core-2.6.1.jar
as it is described in https://github.com/dropbox/dropbox-sdk-java:
If you aren't using Maven, here are the JARs you need:
- Dropbox Core SDK 2.0-beta-4
- Jackson Core 2.6.1 (JSON parser)
- Greg-DB11 years ago
Dropbox Community Moderator
How did you add the jars exactly? E.g., are you using using an IDE like Eclipse, and if so, what steps did you use to add them?
- thanasis k.11 years agoNew member | Level 1
iam using NetBeans IDE, and the two jars added into my project at the "libraries" folder of it, by following the steps below:
project properties -> Libraries -> Add jar/Folder ->
and then i have selected the two jars files to include
- Greg-DB11 years ago
Dropbox Community Moderator
Thanks for the information! I just tried that though, and it worked fine for me. Can you try removing and re-adding the libraries? Also, can you check that you don't have any other/old versions of these jars added?
Here's my test project. Try pasting in an access token and see if it works for you:
https://www.dropbox.com/s/n4i9fx679ejcc1r/test_204631946.zip?dl=1
- thanasis k.11 years agoNew member | Level 1
thank you a lot Gregory for your support. Now it works for me too. I remove and re-add the libraries, and also i have build the project again, and now it works fine.
Now, iam having problem in the part of the code that adds the member to the folder.
ArrayList<AddMember> list = new ArrayList();
DbxSharing.AddMember a1 = new DbxSharing.AddMember(DbxSharing.MemberSelector.email("xxxxxx@gmail.com"),DbxSharing.AccessLevel.editor);
list.add(a1);
dbxClient.sharing.addFolderMember(md.parentSharedFolderId, list);i have try to use also md.id, but iam taking an error like that:
com.dropbox.core.v2.DbxSharing$AddFolderMemberException: Exception in add_folder_member: AddFolderMemberError.{".tag":"access_error","access_error":{".tag":"invalid_id"}}
- thanasis k.11 years agoNew member | Level 1
i gave the final solution to my problem. My working code is:
ArrayList<DbxSharing.AddMember> list = new ArrayList<DbxSharing.AddMember>();
DbxSharing.AddMember a1 = new DbxSharing.AddMember(DbxSharing.MemberSelector.email("xxxxx@gmail.com"), DbxSharing.AccessLevel.editor);
list.add(a1);
ShareFolderLaunch l = dbxClient.sharing.shareFolder("/test");
SharedFolderMetadata md2 = l.getComplete();
dbxClient.sharing.addFolderMember(md2.sharedFolderId,list);
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!