Welcome to the new Box Support website. Check out all the details here on what’s changed.

Move file between the accounts

Answered
New post

Comments

1 comment

  • mbehn-box

    Hi Bharath_N_V,

     

    There are a couple of different methods to transfer ownership of content. One thing that you cannot currently do through the API is transfer the ownership of a single file. Instead, the file will need to be placed into a folder and that folder's ownership will need to be transferred. 

     

    •  To transfer ownership of a folder there are a couple of steps:
      1. The user must already be collaborated into the folder as a co-owner. You can create a collaboration with the user using the create a collaboration endpoint. The Java SDK method for adding a collaboration is documented here. This is done using a token or client that represents the folder owner. When the collaboration is created, you will receive a collaboration_id back from the API response. This will be used to update the collaboration to make the invited user an owner.
      2. With the collaboration_id, update the collaboration's role. With the Java sdk this is done with the updateInfo method on the collaboration. When you create an instance of the collaboration info per the snippet, you will use the setRole() method to update the role to owner.

    Taking the example from the docs it would looks something like this to update the collaboration:

    The COLLABORATION_ID is retrieved when the collaboration is created or by getting collaborations for the file
    
    BoxCollaboration collaboration = new BoxCollaboration(api, "");
    BoxCollaboration.Info info = collaboration.new Info();
    info.setRole(BoxCollaboration.Role.OWNER);
    collaboration.updateInfo(info);

     

    • Another method is to transfer ALL content from one user to another user given the current owner user id and the new owner user id. This can be done with BoxUser.transferContent method.

    I hope this helps!

    0
    Comment actions Permalink

Please sign in to leave a comment.