Best way to Move User's Content
Looking to develop script to Move User's content to Admin Account. I have found 4 ways that this can be accomplished. I am not sure what will be the best strategy here.
1. Change Owner: Change Folder Owner - Box Developer Documentation. According to this documentation: "To change the owner of a folder, first invite the user you wish to transfer the folder to as a collaborator on the folder." and then "Then, update the created collaboration by changing the role of that invited user to owner
."
This works however, I was looking to transfer all of the content to a for the target owner into a specific folder. This fails when there is a exact same name folder/file already in target owner root files/folder
2. Move the folder: Move the folder into a specific target owner folder by updating the parent id of the folder we are trying to move.
This works however, it fails for large folders. The request timesout. The documentation says that this is a synchronous operation and the operation can take hours for large folder.
3. Transfer User Content: https://developer.box.com/reference/put-users-id-folders-0/
I have not tried this, but the documentation says that this is a synchronous call and I suspect I will have same issue like I have in #2.
4. UsersManager.MoveUserFolderAsync: Not sure what is difference between #3 and this one. please let me know.
What I am looking for is something that can work asynchronously. We can invoke a request for transfer of contents (we may have terabytes of data owned by the user and synchronous methods are just not going to work).
Please provide some guidance.
-
So we did this during a data migration, using the powershell module I just posted in this forum.
Basically the script did this:
- Created a folder in an archive folder, which was owned by an admin account
- Added the admin account to the source folder you want to move as co-owner
- Move the box folder. Yes this will time out with large amounts of data, but the process will continue regardless i.e. once you have told Box to do it, it will carry on and may take several hours. At this point you may have to stop your script and run it again.
- Remove all collaborations on the folder, including the original user so they no longer have access
So this all worked fine, we moved about 4TB doing it this way. The only annoying thing were the timeouts, but you won't lose data and it will eventually all move anyway.
-
This is exactly what I am currently doing. But after the transfer is complete, I have to run make the add the original user as viewonly collaborator to the transferred content. The folders are locked until the Move is complete and there is no way to know when it is complete. With this approach, I may have to develop another polling process to keep checking.
I am hoping if there is a better way.
Post is closed for comments.
Comments
5 comments