ibm-sbtibm-connections

Create a folder via IBM sbt and share it to specific user: what is the correct Userid format?


I'm trying to create a folder and share it to a specific user, using SBT in a standalone Java console application (JDK 7).

I started with FileServiceApp sample in sbt/samples, and modified it with the following code:

...
fsa = new FileServiceApp(url, user, password);
FileService fileService = fsa.getFileService();
File newFolder = fileService.createFolder(newFolderName, "description", shareWith);

shareWith is a String that must contain 3 comma separated values: id,(person/community/group),(reader/Contributor/owner) as described in:

http://infolib.lotus.com/resources/social_business_toolkit/javadoc/com/ibm/sbt/services/client/connections/files/FileService.html#createFolder%28java.lang.String,%20java.lang.String,%20java.lang.String%29

update: I just downloaded SBT 1.1.0 and createFolder no longer accepts the shareWith parameter.

But I keep getting a "Not found" error (if shareWith does not contains those 3 elements the error turns to "Bad request").

edited: Calling createFolder without the third parameter just works, but the folder is not shared of course.

I get the same behaviour if I try with the following (with sbt 1.1.0 too):

File newFolder = fileService.createFolder(newFolderName, "description");
Map<String, String> folderParameters = new HashMap<String, String>();
folderParameters.put("shareWith", userID);
folderParameters.put("sharePermission", "View");
fileService.updateFileMetadata(newFolder, folderParameters);

Userid should be correct at least for Smartcloud (the format is: 1f......-b...-4...-b...-f............2 for Greenhouse, 2......1 for Smartcloud). I verified it using ProfileService.getProfile(id), for Smartcloud.

Code has been executed over a greenhouse account, and a collabserv account, using BasicEndpoint in both cases (SmartCloudEndpoint for Smartcloud).

My questions are:

  1. is "share folder" not available in SmartCloud / Greenhouse, and in that case, is it available for a standalone Connections instance?
  2. am I missing anything? (I only put the jars in lib/ext)

Solution

  • Found that the correct format for FileService.createFolder third parameter was

    GUID + ",user,reader"
    

    and not GUID,person,reader. Where GUID is the user GUID as suggested by Paul (not tried with user email yet).