1

I am trying to get the collaboration for a given folder. In the Box sdk given on github the function is public Collaboration GetCollaboration(string collaborationId, IEnumerable fields = null). My question is how do i get the collaboration ID??? After reading the comments in [link] Is there any way to get all files and folder in box without knowing their id? I thought the ID of a given folder is to be given but when i provide that I get an exception "404 not found". Although my folder id "867049500" does have a collaboration enabled. Please see the image below

enter image description here

Community
  • 1
  • 1
Alok Ranjan
  • 158
  • 10

3 Answers3

3

The official Windows SDK provides a method that will fetch the collaborations for a known folder:

var client = new BoxClient(...);
var collabs = await client.FoldersManager.GetCollaborationsAsync(folderId);

(Edited 8/29/14 to point to official SDK)

John Hoerr
  • 7,955
  • 2
  • 30
  • 40
0
  • Rather than this i have been able to explore an alternative for this:

    var boxManager = new BoxApi.V2.BoxManager(userToken);

  • From the above code you get the boxManager, and further:

    var testFolder = boxManager.GetFolder(FolderID);

  • From the above code you get the Folder, and further pass it as shown below:

    CollaborationCollection sampleCollabs = boxManager.GetCollaborations(testFolder, false, null);

It has worked out for me, so i am sharing the solution.

Agilanbu
  • 2,747
  • 2
  • 28
  • 33
Sahil
  • 9
  • 3
0

Using Python, the following can get the collaboration attributes.

Step 1 : Use get_collaborations() method which returns a collaborations collection

collaborations = client.folder(folder_id='Your_target_folder_id').get_collaborations()

Step 2 : Then iterate over collaborations to get the specific collaboration ID

for collab in collaborations:
    collaboration_id = collab.id
Kala Hari
  • 1
  • 1