> For the complete documentation index, see [llms.txt](https://docs.keeper.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.keeper.io/keeperpam/commander-sdk/keeper-commander-sdks/sdk-command-reference/sharing-commands/shared-folder-commands.md).

# Shared Folder Commands

This page documents commands related to shared folder

## Overview

This page catalogs and provides detailed information about shared folders lists and teams.

1. [List-Share-Folder](#list-share-folder)
2. [Share Folder - Change Record Permissions Command](#share-folder-change-record-permissions-command)

## Command

### List Share Folder Command

Lists the shared folders within a specified folder or the current directory in your Keeper vault.

<details>

<summary>DotNet CLI</summary>

**Command:** `sf-list`

**Example:**

```bash
My Vault> sf-list
  #  Shared Folder UID       Name                             # Records  # Users
---  ----------------------  -------------------------------  ---------  -------
  1  shared_folder_uid       Test-Shared-Folder                11         1      
```

</details>

<details>

<summary>DotNet SDK</summary>

**Function:**

```csharp
var sharedFolders = vault.SharedFolders;
```

</details>

<details>

<summary>Power Commander</summary>

**Command:** `Get-KeeperSharedFolder`

**Flag:**

* `-Uid` : Uid of the Shared Folder
* `-Filter` : Used to filter the shared folders.

**Example:**

```powershell
PS> Get-KeeperSharedFolder

Uid                    Name                            DefaultManageRecords DefaultManageUsers DefaultCanEdit DefaultCanShare UserCount RecordCount
---                    ----                            -------------------- ------------------ -------------- --------------- --------- -----------
shared_folder_uid      example_new_shared_folder       True                 True               True           True                    1           1
```

</details>

<details>

<summary>Python CLI</summary>

**Command:** `list-sf`

**Options:**

* `pattern` : Pattern of the title or UID of the shared folder.
* `-h, --help` : show this help message and exit
* `--format` : Specifies the output format of the `list-sf` command. The available options are:
  * ***table:*** The Output will be displayed in table format. By default, the output will be in table format.
    * Example: `--format table`
  * ***csv:*** The Output will be displayed in csv format.
    * Example: `--format csv`
  * ***json*****&#x20;:** The Output will be displayed in json format.
    * Example: `--format json`
* `--output` : Users can use this flag to store the output in a file. This flag should not be used when the output format is set to table (`--format table`).
  * Example: `--output <file_name>`
* `--verbose, -v` : verbose output

**Example:**

```
My Vault> list-sf
  #  Shared Folder UID       Name
---  ----------------------  -----------------------------------------
  1  shared_folder_uid       Test Example Folder
```

</details>

<details>

<summary>Python SDK</summary>

**Function:** `find_shared_folders`

```python
find_shared_folders(self, criteria: str) -> Iterable[vault_types.SharedFolderInfo]
```

**Example:**

```python
shared_folders = vault.vault_data.find_shared_folders(criteria=pattern)
```

</details>

### Shared Folder - Change Record Permissions Command

Allows users to change the permissions of records within a shared folder. Users can add or revoke permissions for individual records as needed.

<details>

<summary>DotNet CLI</summary>

**Command:** `sf-record`

**Flag:**

* `-r, --record` : The record name or record UID of the item that needs to be shared within the shared folder.
* `-s, --can-share` : A Boolean value (`true` or `false`). If `true`, the user has share permission. If `false`, the edit permission will be removed.
* `-e, --can-edit` : A Boolean value (`true` or `false`). If `true`, the user has edit permission. If `false`, the edit permission will be removed.
* `--expire-at` : Expire share at ISO time: YYYY-MM-DD HH:flag\_mm:SS
* `--expire-in` : Expire share in period: \[N]mi|h|d|mo (Minutes / hours / days / months)
* `--help` : Display this help screen.
* `--version` : Display version information.
* `folder name (pos. 0)` : Required. folder name

**Example:**

```bash
My Vault> sf-record record_uid
  #  Record Title   Record UID              Can Edit  Can Share  Expiration
---  -------------  ----------------------  --------  ---------  ----------
  1  ABC            record_uid              X         X
  2  Gmail Account  record_uid              X         X
  3  Gmail Account  record_uid              X         X

My Vault> sf-record folder_uid --record=record_uid --expire-in=30mi

My Vault> sf-record BRvqCEzmFM9rVqkmpeGs6A
  #  Record Title   Record UID              Can Edit  Can Share  Expiration
---  -------------  ----------------------  --------  ---------  ----------------
  1  ABC            record_uid              X         X          03-11-2025 18:08
  2  Gmail Account  record_uid              X         X
  3  Gmail Account  record_uid              X         X
```

</details>

<details>

<summary>DotNet SDK</summary>

**Function:** `ChangeRecordInSharedFolder`

```csharp
public async Task ChangeRecordInSharedFolder(string sharedFolderUid, string recordUid, IRecordShareOptions options)
```

**Example:**

```csharp
await context.Vault.ChangeRecordInSharedFolder(sf.Uid, recordUid, shareOptions);
```

</details>

<details>

<summary>Power Commander</summary>

**Command** : `Set-KeeperSharedFolderRecordPermission`

**Alias:**  `ksfr`

**Flags:**

* `-SharedFolder` : UID, name, or object containing the shared folder UID/name.
* `-Record` : UID or object containing the record UID.
* `-CanEdit` : Whether shared-folder members can edit the record. Accepts `true`, `false`, `1`, or `0`.
* `-CanShare` : Whether shared-folder members can re-share the record. Accepts `true`, `false`, `1`, or `0`.
* `-ExpireIn` : Sets the record permission expiration relative to the current time, such as `30d` or `1h`.
* `-ExpireAt` : Sets an absolute expiration date and time.
* `-RotateOnExpiration` : Rotates the record password when the permission expires. Requires an expiration and a shared folder containing a configured `pamUser` rotation record.
* `-WhatIf` : Previews the permission change without making changes.
* `-Confirm` : Requests confirmation before changing permissions.

**Example:**&#x20;

```powershell
PS> Set-KeeperSharedFolderRecordPermission -SharedFolder "shared_folder_uid" -Record "record_uid" -CanEdit false -CanShare true
```

</details>

<details>

<summary>Python CLI</summary>

**Command**: `record-permission`

**Parameters**:

* `-a`, `--action` Grant or Revoke (required)
* `folder` Shared folder uid to which the changes need to be applied (required)

**Options**:

* `--dry-run` Display the permissions changes without committing them
* `--force` Apply permission changes without any confirmation
* `-R`, `--recursive` Apply permission changes to all sub-folders
* `--share-record` Change a records sharing permissions
* `--share-folder` Change a folders sharing permissions
* `-s`, `--can-share` Set record permission: can be shared
* `-d`, `--can-edit` Set record permission: can be edited
  * **--can-edit or --can-share is required**
* **Example:**

```sh
My Vault> record-permission -a grant --share-record -s -d shared_folder_uid

Request to GRANT "Can Edit" & "Can Share" permission(s) in "my_share" folder only
```

</details>

<details>

<summary>Python SDK</summary>

**Command** :

```python
from keepersdk.vault import share_management_utils
​
result = share_management_utils.update_record_permissions(
            vault=vault,
            action=action,
            can_share=can_share,
            can_edit=can_edit,
            folder_uid_or_path=folder_uid_or_path,
            recursive=recursive,
            share_record=share_record,
            share_folder=share_folder,
            dry_run=dry_run,
            sync_after=sync_after,
        )
```

</details>

### Add user or team to Share Folder Command

Add a user or team to a shared folder with specified access permissions.

<details>

<summary>DotNet CLI</summary>

**Command:** Coming soon.

</details>

<details>

<summary>DotNet SDK</summary>

**Function:**

```csharp
    public bool PutUserToSharedFolder(string sharedFolderUid, string userId, UserType userType, IUserShareOptions options = null)
    {
        if (!TryGetFolderByUid(sharedFolderUid, out var f))
        {
            BatchLogger?.Invoke(Severity.Warning, $"Folder UID \"{sharedFolderUid}\" not found");
            return false;
        }

        switch (f.FolderType)
        {
            case FolderType.UserFolder:
                BatchLogger?.Invoke(Severity.Warning, $"Folder UID \"{sharedFolderUid}\" is not a shared folder");
                return false;
            case FolderType.SharedFolderFolder:
                BatchLogger?.Invoke(Severity.Information, $"Folder UID \"{sharedFolderUid}\" is a shared subfolder folder. Selecting a parent shared folder.");
                sharedFolderUid = f.SharedFolderUid;
                if (!TryGetFolderByUid(sharedFolderUid, out f))
                {
                    BatchLogger?.Invoke(Severity.Warning, $"Folder UID \"{sharedFolderUid}\" not found");
                }
                if (f.FolderType != FolderType.SharedFolder)
                {
                    BatchLogger?.Invoke(Severity.Warning, $"Folder UID \"{sharedFolderUid}\" is not a shared folder");
                }
                break;
        }

        SharedFolderMember pendingMembership = null;

        if (_sharedFolderMembership.TryGetValue(sharedFolderUid, out var currentSharedFolder))
        {
            currentSharedFolder.TryGetValue(userId, out pendingMembership);
        }

        if (pendingMembership != null)
        {
            pendingMembership.IsRemove = false;
            pendingMembership.Options = options;
            return true;
        }

        pendingMembership = new SharedFolderMember
        {
            UserId = userId,
            UserType = userType,
            IsRemove = false,
            Options = options,
        };
        if (currentSharedFolder == null)
        {
            currentSharedFolder = new Dictionary<string, SharedFolderMember>();
            _sharedFolderMembership.Add(sharedFolderUid, currentSharedFolder);
        }
        currentSharedFolder.Add(userId, pendingMembership);
        return true;
    }
```

</details>

<details>

<summary>Power Commander</summary>

**Command:** `Grant-KeeperSharedFolderAccess -SharedFolder <String> [-User <String>] [-Team <String>] [-ManageUsers <Boolean>] [-ManageRecords <Boolean>] [-TransferRecords <Boolean>] [-AllowShareFullVault <Boolean>] [-WhatIf] [-Confirm]`

**Flag:**

* `-SharedFolder` : Shared folder UID or name to which access will be granted.
* `-User` : Email or user UID to grant access to. Either `-User` or `-Team` must be specified.
* `-Team` : Team UID or name to grant access to. Either `-User` or `-Team` must be specified.
* `-ManageUsers` : Grant permission to manage users in the shared folder.
* `-ManageRecords` : Grant permission to manage records in the shared folder.
* `-TransferRecords` : Grant permission to transfer record ownership within the shared folder.
* `-AllowShareFullVault` : Grant permission to share records from the full vault (not just shared folder).
* `-WhatIf` : Shows what would happen if the cmdlet runs without actually executing.
* `-Confirm`  : Prompts for confirmation before executing the cmdlet.

**Example:**

```powershell
PS> Grant-KeeperSharedFolderAccess -SharedFolder "Marketing" -User "john.doe@company.com"

PS> Grant-KeeperSharedFolderAccess -SharedFolder "Finance" -User "jane.smith@company.com" 
    -ManageUsers $true -ManageRecords $true
```

</details>

<details>

<summary>Python CLI</summary>

**Command:**  coming Soon

</details>

<details>

<summary>Python SDK</summary>

**Function:** Coming soon

</details>

### Remove user or team from Share Folder Command

Remove a user or team from a shared folder.

<details>

<summary>DotNet CLI</summary>

**Command:** Coming soon.

</details>

<details>

<summary>DotNet SDK</summary>

**Function:**

```csharp
        public async Task RemoveUserFromSharedFolder(string sharedFolderUid, string userId, UserType userType)
        {
            var sharedFolder = this.GetSharedFolder(sharedFolderUid);
            var perm = sharedFolder.UsersPermissions.FirstOrDefault(x => x.UserType == userType &&
            (string.Equals(x.Uid, userId, StringComparison.InvariantCulture) || string.Equals(x.Name, userId, StringComparison.InvariantCultureIgnoreCase)));

            if (perm == null)
            {
                return;
            }

            var request = new SharedFolderUpdateV3Request
            {
                SharedFolderUid = ByteString.CopyFrom(sharedFolder.Uid.Base64UrlDecode()),
                EncryptedSharedFolderName = ByteString.CopyFrom(CryptoUtils.EncryptAesV1(Encoding.UTF8.GetBytes(sharedFolder.Name), sharedFolder.SharedFolderKey)),
                ForceUpdate = true,

            };
            {
                var ap = this.ResolveSharedFolderAccessPath(Auth.Username, sharedFolderUid, true);
                if (ap != null && ap.UserType == UserType.Team)
                {
                    request.FromTeamUid = ByteString.CopyFrom(perm.Uid.Base64UrlDecode());
                }
            }

            if (userType == UserType.User)
            {
                request.SharedFolderRemoveUser.Add(perm.Name);
            }
            else
            {
                request.SharedFolderRemoveTeam.Add(ByteString.CopyFrom(perm.Uid.Base64UrlDecode()));
            }

            var response = await Auth.ExecuteAuthRest<SharedFolderUpdateV3Request, SharedFolderUpdateV3Response>("vault/shared_folder_update_v3", request);
            foreach (var arr in (new[] { response.SharedFolderRemoveUserStatus }))
            {
                var failed = arr?.FirstOrDefault(x => x.Status != "success");
                if (failed != null)
                {
                    throw new VaultException($"Remove User \"{failed.Username}\" from Shared Folder \"{sharedFolder.Name}\" error: {failed.Status}");
                }
            }

            foreach (var arr in (new[] { response.SharedFolderRemoveTeamStatus }))
            {
                var failed = arr?.FirstOrDefault(x => x.Status != "success");
                if (failed != null)
                {
                    var uid = failed.TeamUid.ToArray().Base64UrlEncode();
                    throw new VaultException($"Remove Team \"{uid}\" from Shared Folder \"{sharedFolder.Name}\" error: {failed.Status}");
                }
            }

            await SyncDown();
        }
```

</details>

<details>

<summary>Power Commander</summary>

**Command:** `Revoke-KeeperSharedFolderAccess -SharedFolder <String> [-User <String>] [-Team <String>] [-Force] [-WhatIf] [-Confirm]`

**Flag:**

* `-SharedFolder` : Shared folder UID or name to which access will be granted.
* `-User` : Email or user UID to grant access to. Either `-User` or `-Team` must be specified.
* `-Team` : Team UID or name to grant access to. Either `-User` or `-Team` must be specified.
* `-Force` : Revoke access without confirmation prompt.
* `-WhatIf` : Shows what would happen if the cmdlet runs without actually executing.
* `-Confirm`  : Prompts for confirmation before executing the cmdlet.

**Example:**

```powershell
PS> Grant-KeeperSharedFolderAccess -SharedFolder "Marketing" -User "john.doe@company.com"

PS> Grant-KeeperSharedFolderAccess -SharedFolder "Finance" -User "jane.smith@company.com" 
    -ManageUsers $true -ManageRecords $true
```

</details>

<details>

<summary>Python CLI</summary>

**Command:**  coming Soon

</details>

<details>

<summary>Python SDK</summary>

**Function:** Coming soon

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
