简体   繁体   English

Boxapi:将管理文件移动/复制到服务帐户

[英]Boxapi: Move/copy admin files to service account

I have been using box since from a year.我从一年开始就一直在使用盒子。 I manually upload files to Box.我手动将文件上传到 Box。 A few days back I integrated my nodejs code to Box (api's).几天前,我将我的 nodejs 代码集成到 Box(api)中。 I have created an app and set up Client Credentials Grant Authentication, which is a service account by default and I am able to upload files and folders.我创建了一个应用程序并设置了客户端凭据授予身份验证,默认情况下这是一个服务帐户,我能够上传文件和文件夹。 But I already have hundreds of files in my admin account.但是我的管理员帐户中已经有数百个文件。 And instead of creating all those files again under my new service account, I want to move all those content to the service account.而不是在我的新服务帐户下再次创建所有这些文件,我想将所有这些内容移动到服务帐户。 I read the docs about de-provision, but I am not sure if that is what I am looking for.我阅读了有关取消配置的文档,但我不确定这是否是我想要的。 Any suggestions on how can I do this?.关于如何做到这一点的任何建议? Thanks in advance.提前致谢。

Finally, I found the solution.最后,我找到了解决方案。 There are two ways(maybe more, but I found these two) to achieve this.有两种方法(可能更多,但我找到了这两种)来实现这一点。

  1. Transfer Owned Folders转移拥有的文件夹
    const sourceUserID = 'exaplesourceId';
    const destinationUserID = 'exampleuserId';
    client.enterprise.transferUserContent(sourceUserID, destinationUserID)
        .then((movedFolder) => {
            resolve(movedFolder);
        }).catch((error) => {
            reject(error);
        });

For reference: https://developer.box.com/guides/users/deprovision/transfer-folders/供参考: https ://developer.box.com/guides/users/deprovision/transfer-folders/

  1. The other way is to give access to the service account user to collaborate on existing content.另一种方法是向服务帐户用户授予访问权限,以便在现有内容上进行协作。 We can do this via the API too.我们也可以通过 API 做到这一点。

Reference: https://developer.box.com/guides/users/deprovision/transfer-folders/参考: https ://developer.box.com/guides/users/deprovision/transfer-folders/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM