Skip to main content
Box Employee
May 21, 2025 10:42 AM UTC
Question

Using Java SDK to dermine if a folder is a collaboration or not?

Hi,

 

I am using the Box Java SDK to access the files and folders of a box user.

 

My question is, if it is possible to determine of a folder is a "real" folder in the folder hierarchy of this user or if it is a collaboration and actually exists in the folder hierarchy of another user.

 

I have the idea to compare the folders owner or creator with the user I am processing, but I am not sure if that is the right way and if yes, if I should take the owner or the creator. But maybe there is a better way?

 

Greetings,

Pascal

    3 replies

    Box Employee
    May 21, 2025 10:42 AM UTC

    Hi Pascal,

     

    Can you help us understand your use case of why the app needs to know this?

     

    Thanks!

    Translate
    Box Employee
    May 21, 2025 10:42 AM UTC

    Hi,

     

    the app tries to get all files from an enterprise and uses the "as-user" header to access the root folders of all the users. For that we use the Box Java SDK. The problem is that a folder that is shared (collaboration) occurs in the folder hierarchy of multiple users and I see no way to distinguish a "real" folder from a collaboration folder.

     

    In the moment I assume that the owner of a folder is the user where the folder really is and therefore if the owner is not the user we currently are using (with the "as-user" header) than the folder is a collaboration and can be ignored. This seems to work.

     

    Greetings,

    Pascal

    Translate
    Box Employee
    May 21, 2025 10:42 AM UTC

    > the owner of a folder is the user where the folder really is and therefore if the owner is not the user we currently are using (with the "as-user" header) than the folder is a collaboration and can be ignored

     

    This is correct. The owner is always going to be the only non-collaborator, and the owner's file tree is the canonical location of the file. Everyone else is a collaborator.

    Translate