Getting Shared Folder Members

Dropbox APIV2 changed the REST calls to get folder members. APIV1 you got the folder members bundled in the JSON return for get shared folder metadata for all folders for all members in 1 REST Call. 


Now you have to make a REST call for every folder passing in as a parameter the folder ID:

 (/api.dropboxapi.com/2/sharing/list_folder_members )

I have looked through the documentation, I have looked through the forum and I've had a look through the actual TMSDropbox component, but cannot workout how to get a list of folder members for a shared folder. 

How, for a shared folder, do I get the list of folder members for each shared folder (you can assume I have the Shared Folder ID)?

Kevin

Hi,


This feature of the DropBox API is currently not supported in TMS VCL Cloud Pack.
We'll have to investigate if this functionality can be added in a future version.

When you say if it can be added, do you mean if it is feasible, the answer is yes, here's the code using INDY to get the members of a share (obviously you need to decode the JSON return? Or do you mean we just might not bother?


   // Create the indy components
    IdSSLIOHandlerSocketOpenSSL1:= TIdSSLIOHandlerSocketOpenSSL.Create(nil);
    IdHTTP1 := TIdHTTP.Create(nil);
    IdHTTP1.IOHandler := IdSSLIOHandlerSocketOpenSSL1;
    IdHTTP1.HandleRedirects := True;
    IdHTTP1.Request.BasicAuthentication := False;
    IdHTTP1.Request.CustomHeaders.Values['Authorization'] := 'Bearer ' + tAccessToken;
    IdHTTP1.Request.ContentType := 'application/json; charset=utf-8';
    // A complete read should take no more than 5 seconds, should connect in a couple of seconds
    IdHTTP1.ConnectTimeout := 3000;
    // Reads normally take a second or so - Timeout after 10 Seconds
    IdHTTP1.ReadTimeout := 10000;
    StrReq := TStringStream.Create('{"shared_folder_id": "' + tSharedFolderID + '"}', TEncoding.UTF8);
    tJSONReturn := IdHTTP1.Post(DropBoxURL,StrReq);

We've added this function to the feature request list for the TMS VCL Cloud Pack.
It will be considered to be included in a future version.