> ## Documentation Index
> Fetch the complete documentation index at: https://developer.box.com/llms.txt
> Use this file to discover all available pages before exploring further.

# ユーザーのプロビジョニング解除

export const MultiRelatedLinks = ({sections = []}) => {
  if (!sections || sections.length === 0) {
    return null;
  }
  return <div className="space-y-8">
      {sections.map((section, index) => <RelatedLinks key={index} title={section.title} items={section.items} />)}
    </div>;
};

export const RelatedLinks = ({title, items = []}) => {
  const getBadgeClass = badge => {
    if (!badge) return "badge-default";
    const badgeType = badge.toLowerCase().replace(/\s+/g, "-");
    return `badge-${badge === "ガイド" ? "guide" : badgeType}`;
  };
  if (!items || items.length === 0) {
    return null;
  }
  return <div className="my-8">
      {}
      <h3 className="text-sm font-bold uppercase tracking-wider mb-4">{title}</h3>

      {}
      <div className="flex flex-col gap-3">
        {items.map((item, index) => <a key={index} href={item.href} className="py-2 px-3 rounded related_link hover:bg-[#f2f2f2] dark:hover:bg-[#111827] flex items-center gap-3 group no-underline hover:no-underline border-b-0">
            {}
            <span className={`px-2 py-1 rounded-full text-xs font-semibold uppercase tracking-wide flex-shrink-0 ${getBadgeClass(item.badge)}`}>
              {item.badge}
            </span>

            {}
            <span className="text-base">{item.label}</span>
          </a>)}
      </div>
    </div>;
};

通常のBox Enterpriseの保守の一部として、会社内でアクティブではなくなったユーザーのアカウントを削除します。会社からユーザーを削除する際は、ユーザーアカウントを削除する前に、そのユーザーが所有するすべてのコンテンツを別のアカウントに移動する必要があります。

<Note>
  ユーザーアカウントにまだコンテンツがある場合、ユーザー削除リクエストは失敗します。ユーザーアカウントとアカウント内のすべてのコンテンツを強制的に削除するオプションである`force`パラメータを、APIコールで使用できます。
</Note>

ユーザーアカウントを廃止する際の標準的なベストプラクティスは、そのユーザーが所有するすべてのコンテンツを別の管理者レベルアカウントまたはアプリケーションサービスアカウントに移動することです。移動したら、コンテンツの所有権を別のユーザーに移管するか、必要に応じてそのコンテンツで別のユーザーとコラボレーションをすることができます。

## プロビジョニング解除の例

以下のコードサンプルを使用して、ユーザーのコンテンツを転送し、ユーザーを削除できます。コンテンツが転送される際には、次のパターンに従って転送先ユーザーのルートフォルダに新しいフォルダが作成されます。`employee_email@email.com - employee_name's Files and Folders`

<Tabs>
  <Tab title="Node">
    ```js theme={null}
    'use strict'
    const box = require('box-node-sdk');
    const fs = require('fs');

    let configFile = fs.readFileSync('config.json');
    configFile = JSON.parse(configFile);

    let session = box.getPreconfiguredInstance(configFile);
    let serviceAccountClient = session.getAppAuthClient('enterprise');

    const transferUserID = '3278487052';
    (async () => {
        let serviceAccount = await serviceAccountClient.users.get('me');
        let transferredFolder = await serviceAccountClient.enterprise.transferUserContent(transferUserID,serviceAccount.id);
        console.log(transferredFolder);
        await serviceAccountClient.users.delete(transferUserID, null);
        console.log('Completed');
    })();
    ```
  </Tab>

  <Tab title="Java">
    ```java theme={null}
    Path configPath = Paths.get("config.json");
    try (BufferedReader reader = Files.newBufferedReader(configPath,Charset.forName("UTF-8"))){
        String transferUserId = "3277722534";

        BoxConfig boxConfig = BoxConfig.readFrom(reader);
        BoxDeveloperEditionAPIConnection serviceAccountClient = BoxDeveloperEditionAPIConnection
          .getAppEnterpriseConnection(boxConfig);

        BoxUser destinationUser = new BoxUser(serviceAccountClient,
            BoxUser.getCurrentUser(serviceAccountClient).getID());
        try {
            destinationUser.moveFolderToUser(transferUserId);
        } catch (BoxAPIException e) {}

        BoxUser removeUser = new BoxUser(serviceAccountClient, transferUserId);
        removeUser.delete(false, false);
    }
    ```
  </Tab>

  <Tab title=".NET">
    ```csharp theme={null}
    using(FileStream fs = new FileStream("./config.json", FileMode.Open)) {
        var config = BoxConfig.CreateFromJsonFile(fs);
        var session = new BoxJWTAuth(config);
        var serviceAccountClient = session.AdminClient(session.AdminToken());

        var transferUserId = "3276247601";

        var serviceAccount = await serviceAccountClient.UsersManager.GetCurrentUserInformationAsync();
        var moveAction = await serviceAccountClient.UsersManager.MoveUserFolderAsync(transferUserId,serviceAccount.Id);

        System.Console.WriteLine(moveAction.Name);
        await serviceAccountClient.UsersManager.DeleteEnterpriseUserAsync(transferUserId,false,false);
    }
    ```
  </Tab>

  <Tab title="CLI">
    ```shell theme={null}
    box users:transfer-content $transfer_from_user_id $transfer_to_user_id
    box users:delete $transfer_from_user_id --yes
    ```
  </Tab>
</Tabs>

<RelatedLinks
  title="関連するAPI"
  items={[
{ label: translate("Delete user"), href: "/reference/delete-users-id", badge: "DELETE" }
]}
/>

<RelatedLinks
  title="関連するガイド"
  items={[
{ label: translate("Transfer Files & Folders"), href: "/guides/users/deprovision/transfer-folders", badge: "GUIDE" }
]}
/>
