全部產品
Search
文件中心

Drive and Photo Service:檔案授權

更新時間:Dec 23, 2025

檔案授權和共用的一些操作方法。

listShareFiles 方法

重要

標準模式支援

警告

託管模式不支援

查詢我的共用檔案清單

const result = await client.listShareFiles(params, options)

參數說明

欄位

類型

必選

說明

params

IListReq

預設為 {}

options

AxiosRequestConfig

其它配置項

IListReq

欄位

類型

必選

說明

limit

number

一次查詢多少條資料

marker

string

標記

返回

欄位

類型

必選

說明

result

IListRes<IFileItem>

返回結果

IListRes

欄位

類型

必選

說明

items

array

查詢到的檔案資訊列表,items 中每一項的具體欄位可查看 IFileItem 的說明

next_marker

string

分頁標記

punished_file_count

number

檔案夾會返回

IFileItem

欄位

類型

必選

說明

action_list

string[]

許可權列表

created_at

Date

建立時間

creator_id

string

建立人的id

creator_name

string

建立人的名稱

creator_type

string

建立人的類型

domain_id

string

domain ID

drive_id

string

雲端硬碟id

encrypt_mode

string

是否以加密形式分享

file_id

string

檔案id

hidden

boolean

顯示隱藏

last_modifier_id

string

修改人的id

last_modifier_name

string

修改人的名稱

last_modifier_type

string

修改人的類型

name

string

檔案名稱

parent_file_id

string

上一級目錄id

revision_id

string

版本

starred

boolean

是否收藏, true 是

status

string

檔案狀態, available | enabled

type

string

檔案類型 folder

updated_at

Date

檔案更新時間

listReceivedShareFiles 方法

重要

標準模式支援

警告

託管模式不支援

查詢收到的共用檔案資訊

const result = await client.listReceivedShareFiles(params, options)

參數說明

欄位

類型

必選

說明

params

IListReq

預設為 {}

options

AxiosRequestConfig

其它配置項

IListReq

欄位

類型

必選

說明

limit

number

一次查詢多少條資料

marker

string

標記

返回

欄位

類型

必選

說明

result

IListRes<IFileItem>

返回結果

IListRes

欄位

類型

必選

說明

items

array

查詢到的檔案資訊列表,items 中每一項的具體欄位可參考關於 IFileItem 的說明

next_marker

string

分頁標記

punished_file_count

number

檔案夾會返回

listManageSharingFiles 方法

重要

標準模式支援

警告

託管模式不支援

列舉目前使用者管理的共用記錄

const result = await client.listManageSharingFiles(params, options)

參數說明

欄位

類型

必選

說明

params

IListReq

查詢參數,不傳預設為 {}

options

AxiosRequestConfig

其它配置項

IListReq

欄位

類型

必選

說明

limit

number

一次查詢多少條資料

marker

string

標記

返回

欄位

類型

必選

說明

result

IListRes

返回結果

IListRes

欄位

類型

必選

說明

items

array

查詢到的檔案資訊列表,items 中每一項的具體欄位可參考第1項關於 IFileItem 的說明

next_marker

string

分頁標記

addFilePermission 方法

重要

標準模式支援

警告

託管模式不支援

添加檔案授權資訊(建立共用,更新共用)

const result = await client.addFilePermission(params, options)

參數說明

欄位

類型

必選

說明

params

IAddFilePermissionReq

建立共用的資訊

options

AxiosRequestConfig

其它配置項

IAddFilePermissionReq

欄位

類型

必選

說明

drive_id

string

雲端硬碟id

file_id

string

共用檔案的ID

member_list

array

要共用給的使用者物件集合,數組每一項請參考 IPermissionStandard 說明

IPermissionStandard

欄位

類型

必選

說明

identity

object

包含 identity_type 和 identity_id 兩個欄位

expire_time

number

時間戳記

role_id

string

角色id

disinherit_sub_group

boolean

是否繼承子團隊

傳回值

StandardMode 模式下建立成功,沒有傳回值,失敗則拋出異常資訊。

removeFilePermission 方法

重要

標準模式支援

警告

託管模式不支援

移除檔案許可權(刪除共用)

await client.removeFilePermission(params, options)

參數說明

欄位

類型

必選

說明

params

IAddFilePermissionReq

要刪除的共用檔案

options

AxiosRequestConfig

其它配置項

傳回值

刪除成功,沒有傳回值,失敗則拋出異常資訊。

listFilePermissions 方法

重要

標準模式支援

警告

託管模式不支援

擷取檔案的授權成員

const result = await client.listFilePermission(params, options)

參數說明

欄位

類型

必選

說明

params

IListPermissionReq

查詢參數

options

AxiosRequestConfig

其它配置項

IListPermissionReq

欄位

類型

必選

說明

drive_id

string

雲端硬碟id

file_id

string

檔案id

返回

欄位

類型

必選

說明

result

array

返回結果, 其中每一項請查看關於 IPermissionStandard 的說明

IPermissionStandard

欄位

類型

必選

說明

identity

object

包含identity_name, identity_type 和 identity_id 欄位

expire_time

number

時間戳記

role_id

string

角色id

disinherit_sub_group

boolean

是否繼承子團隊

listFileInheritPermissions 方法

重要

標準模式支援

警告

託管模式不支援

繼承自上級目錄的許可權

const result = await client.listFileInheritPermission(params, options)

參數說明

欄位

類型

必選

說明

params

IListPermissionReq

options

AxiosRequestConfig

其它配置項

IListPermissionReq

欄位

類型

必選

說明

drive_id

string

雲端硬碟id

file_id

string

檔案id

返回

欄位

類型

必選

說明

result

IListRes

返回結果

IListRes

欄位

類型

必選

說明

items

IListInheritRes[]

next_marker

string

分頁標記

IListInheritRes

欄位

類型

必選

說明

member

IListPermissionRes

file_id

string

分頁標記

IListPermissionRes

欄位

類型

必選

說明

disinherit_sub_group

boolean

是否繼承自上級

expire_time

number

時間戳記

role_id

string

角色ID

domain_id

string

domain ID

drive_id

string

雲端硬碟

file_id

string

檔案ID

creator

string

建立人

created_at

number

建立時間

can_access

boolean

是否可以訪問

identity

IIdentityRes

身份資訊

IIdentityRes

欄位

類型

必選

說明

identity_id

string

身份id

identity_name

string

名稱

identity_type

string

類型

listUserPermissions 方法

重要

標準模式支援

警告

託管模式不支援

使用者維度,擷取使用者被授權的資訊

const result = await client.listUserPermission(params, options)

參數說明

欄位

類型

必選

說明

params

IUserPermissionReq

查詢參數

options

AxiosRequestConfig

其它配置項

IUserPermissionReq

欄位

類型

必選

說明

user_id

string

使用者id

type

string

使用者類型,可選值 'self' | 'group'

返回

欄位

類型

必選

說明

result

IListRes

返回結果

IListRes

欄位

類型

必選

說明

items

IListPermissionRes[]

請查看關於 IListPermissionRes 的說明

next_marker

string

分頁標記