# 共有コマンド

### 概要

ユーザーへの共有に関して使うコマンドの一覧です。

1. [レコード共有コマンド](/keeperpam/jp/commander-sdk/keeper-commander-sdks/sdk-command-reference/sharing-commands/record-share-command.md#share-record-share-command)
2. [共有フォルダのユーザー共有コマンド](/keeperpam/jp/commander-sdk/keeper-commander-sdks/sdk-command-reference/sharing-commands/shared-folder-commands.md#share-folder-command)
3. [ワンタイム共有の一覧コマンド](#one-time-share-list-command)
4. [ワンタイム共有の作成コマンド](#one-time-share-create-command)
5. [ワンタイム共有の削除コマンド](#one-time-share-remove-command)

### ワンタイム共有の作成コマンド <a href="#one-time-share-create-command" id="one-time-share-create-command"></a>

ボルト内のレコードの共有リンクを作成し、外部のユーザーに認証情報やレコード情報を共有するために使います。リンクは1台のデバイス/ブラウザでのみ開け、そのデバイス/ブラウザではリンクの有効期限まで再び開ける、という動作になります。

<details>

<summary>DotNet CLI</summary>

**コマンド**: `one-time-share`

**フラグ**:

* `--client` : ワンタイム共有のアクション名 `create` 。コマンド直後の位置0の必須の位置引数。
* `--expire` : 共有の失効までの期間 **\[(m)inutes|(h)ours|(d)ays**。`create` 引数と併用する。
* `--help` : このヘルプ画面を表示する。
* `--version` : バージョン情報を表示する。
* `value pos. 0` : 実行するアクションを指定する必須の位置引数。コマンド直後の位置0に置く。受け付ける値は次のとおり。
  * **`create`** – 新しいワンタイム共有を作成する
* `value (pos. 1)` : 必須。共有するレコードのUIDまたはパス。コマンド直後の位置1に置く位置引数。

**例:**

<pre class="language-csharp"><code class="lang-csharp"><strong>My Vault > one-time-share create record_uid --expire 2m
</strong>URL: https://keepersecurity.com:443/vault/share#asdfsadf
</code></pre>

</details>

<details>

<summary>DotNet SDK</summary>

**メソッド:**

```csharp
public static async Task<string> CreateExternalRecordShare(this VaultOnline vault, 
        string recordUid, 
        TimeSpan expireIn, 
        string shareName = null)
```

**引数:**

* `vault` : ボルトコンテキストで使用する。

```csharp
vault.CreateExternalRecordShare(record.Uid, TimeSpan expireIn)
```

* `recordUid` : 共有するレコードのUid。
* `TimeSpan` : レコードの有効期限を設定するTimeSpanクラスのオブジェクト。
* `shareName` : ワンタイム共有の名前。

</details>

<details>

<summary>Power Commander</summary>

**コマンド**: `New-KeeperOneTimeShare`

**別名:** `kotsn`

**フラグ**:

* `-Uid` : レコードのUid
* `-ExpireIn` : ワンタイム共有の失効までの時間 (分)
* `-ExpireAt` : ワンタイム共有の失効日時 (日付形式)
* `-ShareName` : ワンタイム共有のレコード名

**例:**

```powershell
PS > New-KeeperOneTimeShare -Uid record_uid -ExpireIn 5 -ShareName "Example Share" 
https://keepersecurity.com:443/vault/share#qwertyuiopasdfghjklzxcvbnm
```

</details>

<details>

<summary>Python CLI</summary>

**コマンド:** `share-create`

**パラメータ:**

* `record` : 共有URLを作成する対象の \<RECORD\_UID> またはパス
* `-e, --expire` : 共有URLの有効期限。経過後はリンクは無効。設定できる最大期間は6ヶ月または182日

**オプション:**

* `--name` : 共有URLの名前
* `--editable` : 共有レコードの編集を許可する
* `--output` : 共有URLの出力先 (クリップボードまたはコンソール/標準出力)

**例:**

```sh
My Vault> share-create --name='share_record' -e=30d record_uid
https://keepersecurity.com/vault/share#asdfsdjkkadsfdasfasdf
```

</details>

<details>

<summary>Python SDK</summary>

**関数:** `create_one_time_share`

```python
from keepersdk.vault import one_time_share

url = one_time_share.create_one_time_share(
            vault=vault,
            record_uid=record_uid,
            expiration_period=expiration_period,
            name=ots_name or None,
            is_editable=is_editable,
            is_self_destruct=is_self_destruct,
        )
```

</details>

### ワンタイム共有の一覧コマンド <a href="#one-time-share-list-command" id="one-time-share-list-command"></a>

レコードまたはフォルダに対して作成されたワンタイム共有を一覧するために使います。レコード/フォルダUID、共有名、共有ID、作成日時、アクセス日時、失効日時、およびリンクの状態 (生成済み、アクセス済み、失効) を表示します。

<details>

<summary>DotNet CLI</summary>

**コマンド**: `one-time-share`

**アクション:**

実行するアクションを指定する必須の位置引数。コマンド直後の位置0に置く。受け付ける値は次のとおり。

* **`list`** – レコードのワンタイム共有URLの一覧を表示する。

**フラグ**:

* `value pos. 1` : 必須。対象のレコードUIDまたはパス。コマンド直後の位置1に置く位置引数。
* `--client` : ワンタイム共有のアクション名 `list`。コマンド直後の位置0の必須の位置引数。
* `--help` : このヘルプ画面を表示する。
* `--version` : バージョン情報を表示する。

**例:**

```csharp
My Vault> one-time-share list record_uid  --client "Example Share" 
  #  Record UID              Record Title    Share Name   Generated          Opened             Expires          
---  ----------------------  -------------   -----------  -----------------  -----------------  -----------------    
  1  record_uid              Example Record  Share_name   8/28/2025 5:58 PM  8/28/2025 5:58 PM  8/28/2025 6:00 PM
```

</details>

<details>

<summary>DotNet SDK</summary>

**メソッド:**

```csharp
public static async Task<ExternalRecordShare[]> GetExernalRecordShares(
    this VaultOnline vault, 
    string recordUid
)
```

**引数:**

* `vault` : ボルトコンテキストで使用する。

```csharp
Vault.GetExernalRecordShares(record.Uid)
```

* `recordUid` : ワンタイム共有の一覧を表示するレコードのUID。

</details>

<details>

<summary>Power Commander</summary>

**コマンド**: `Get-KeeperOneTimeShare`

**別名:** `kotsg`

**フラグ**:

* `-Uid` : レコードのUid

**例:**

```powershell
PS > Get-KeeperOneTimeShare record_uid

RecordUid              RecordTitle   Owner Users Folders
---------              -----------   ----- ----- -------
record_uid             Example Record         1       1
```

</details>

<details>

<summary>Python CLI</summary>

**コマンド**: `share-list`

パラメータ:

* `record` : レコード/フォルダの \<UID> またはパス

**オプション**:

* `-v, --verbose` : 共有IDが長い場合に省略されないよう全体を表示する。
* `-a, --all` : 失効済みを含むすべてのワンタイム共有を表示する
* `-R, --recursive` : サブフォルダを再帰的にたどる
* `--format` : 出力形式 - table、json、csv

**例:**

```sh
My Vault> share-list record_uid --all

Record UID               Share Link Name    Share Link ID                                       Generated            Opened    Expires              Status
----------------------   -----------------  --------------------------------------------        -------------------  --------  -------------------  --------
record_uid                                  Share_link_uid                                      2025-08-06 16:54:11            2025-08-06 17:24:11  Expired
```

</details>

<details>

<summary>Python SDK</summary>

**関数:** `list_one_time_shares`

```python
from keepersdk.vault import one_time_share

shares: list[one_time_share.OneTimeShare] = one_time_share.list_one_time_shares(
                vault=vault,
                record_uid=record_uids[:1000],
                include_expired=True,
            )
```

</details>

### ワンタイム共有の削除コマンド <a href="#one-time-share-remove-command" id="one-time-share-remove-command"></a>

レコードまたはフォルダのワンタイム共有リンクを削除するために使います。

<details>

<summary>DotNet CLI</summary>

**コマンド**: `one-time-share`

**フラグ**:

* `--client` : ワンタイム共有のアクション名 `delete`。コマンド直後の位置0の必須の位置引数。
* `--help` : このヘルプ画面を表示する。
* `--version` : バージョン情報を表示する。
* `value pos. 0` : 実行するアクションを指定する必須の位置引数。コマンド直後の位置0に置く。受け付ける値は次のとおり。
  * **`delete`** – ワンタイム共有を削除する
* `value pos. 1` : 必須。対象のレコードUIDまたはパス。コマンド直後の位置1に置く位置引数。

**例:**

```csharp
My Vault> one-time-share delete record_uid  --client "Example Share"  
```

</details>

<details>

<summary>DotNet SDK</summary>

**メソッド:**

```csharp
public static async Task DeleteExernalRecordShares(
    this VaultOnline vault, 
    string recordUid, 
    IEnumerable<string> clientId
)
```

**引数:**

* `VaultOnline` : ボルトコンテキストで使用する。

```csharp
var shares = (await context.Vault.GetExernalRecordShares(record.Uid))
Vault.DeleteExernalRecordShares(record.Uid, 
    shares.Select(x => x.ClientId))
```

* `ClientId` : レコードの共有のクライアントID。

</details>

<details>

<summary>Power Commander</summary>

**コマンド**: `Remove-KeeperOneTimeShare`

**別名:** `kotsr`

**フラグ**:

* `-Uid` : レコードのUid
* `-ShareName` : 共有名の一覧

**例:**

```powershell
PS > Remove-KeeperOneTimeShare -Uid record_uid  -ShareName "Example Share"                     
```

</details>

<details>

<summary>Python CLI</summary>

**コマンド**: `share-remove`

**パラメータ**: **必須**

* `record` : レコードまたはフォルダのUIDまたはパス
* `share` : ワンタイム共有ID

**例:**

```sh
My Vault> share-remove record_uid shared_link_uid
One-time share "share_link_uid" is removed from record "record_uid"
```

</details>

<details>

<summary>Python SDK</summary>

**関数:** `remove_one_time_share`

```python
from keepersdk.vault import one_time_share

one_time_share.remove_one_time_share(
            vault=vault,
            record_uid=record_uid,
            share_identifier=share_identifier, ## 共有ID
        )
```

</details>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keeper.io/keeperpam/jp/commander-sdk/keeper-commander-sdks/sdk-command-reference/sharing-commands.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
