All Products
Search
Document Center

Drive and Photo Service:Manage permissions on files

Last Updated:Dec 22, 2025

This topic describes the methods that are used to manage permissions on files.

Note

The options parameter of the IPDSRequestConfig type is encapsulated based on the request config options of axios. For more information, see AxiosRequestConfig.

listSharingFiles method

Queries a list of shared files.

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

Request parameters

Parameter

Type

Required

Description

params

IListReq

No

The request parameters that are used to query a list of shared files. If you do not specify this parameter, the default value {} is used.

options

IPDSRequestConfig

No

Other request parameters.

IListReq fields

Field

Type

Required

Description

limit

number

Yes

The maximum number of entries to return.

marker

string

Yes

The start marker of the query.

Response parameters

Parameter

Type

Required

Description

result

IListRes<IFileItem>

Yes

The returned result.

IListRes fields

Field

Type

Required

Description

items

array

Yes

The list of files returned. For more information, see the following table.

next_marker

string

Yes

The pagination token.

punished_file_count

number

No

The number of files that are punished.

IFileItem fields

Field

Type

Required

Description

action_list

string[]

No

The permissions on the file.

created_at

Date

Yes

The time when the file was created.

creator_id

string

No

The ID of the user who created the file.

creator_name

string

No

The name of the user who created the file.

creator_type

string

No

The type of the user who created the file.

domain_id

string

Yes

The domain ID.

drive_id

string

Yes

The drive ID.

encrypt_mode

string

No

The encryption mode of the file.

file_id

string

No

The file ID.

hidden

boolean

No

Indicates whether the file is hidden.

last_modifier_id

string

No

The ID of the user who last modified the file.

last_modifier_name

string

No

The name of the user who last modified the file.

last_modifier_type

string

No

The type of the user who last modified the file.

name

string

No

The file name.

parent_file_id

string

No

The ID of the parent directory of the file.

revision_id

string

No

The version of the file.

starred

boolean

No

Indicates whether the file is added to favorites. A value of true indicates that the file is added to favorites.

status

string

Yes

The status of the file. Valid values: available and enabled.

type

string

No

The type of the file. Example: folder.

updated_at

Date

Yes

The time when the file was updated.

listReceivedFiles method

Queries the information about the shared files that are received.

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

Request parameters

Parameter

Type

Required

Description

params

IListReq

No

The request parameters that are used to query the information about the shared files that are received. If you do not specify this parameter, the default value {} is used.

options

IPDSRequestConfig

No

Other request parameters.

IListReq fields

Field

Type

Required

Description

limit

number

No

The maximum number of entries to return.

marker

string

No

The start marker of the query.

Response parameters

Parameter

Type

Required

Description

result

IListRes<IFileItem>

Yes

The returned result.

IListRes fields

Field

Type

Required

Description

items

array

Yes

The information about the queried files. For more information, see the following table.

next_marker

string

No

The pagination token.

punished_file_count

number

No

The number of files that are punished.

addFilePermission method

Creates or updates a share for a file.

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

Request parameters

Parameter

Type

Required

Description

params

IAddFilePermissionReq

Yes

The request parameters that are used to create or update a share for a file.

options

IPDSRequestConfig

No

Other request parameters.

IAddFilePermissionReq fields

Field

Type

Required

Description

drive_id

string

Yes

The drive ID.

file_id

string

No

The ID of the file to be shared.

member_list

array

No

The users with whom you want to share the file. For more information, see the following table.

IPermissionStandard fields

Field

Type

Required

Description

identity

object

Yes

The identity of the users with whom you want to share the file. This parameter contains the identity_type and identity_id fields.

expire_time

number

Yes

The time when the file expires. Set the value to a UNIX timestamp.

role_id

string

Yes

The role ID.

disinherit_sub_group

boolean

Yes

Specifies whether to inherit subgroups.

Response parameters

If the share is created or updated for the file in standard mode, no values are returned. Otherwise, an error message is returned.

removeFilePermission method

Deletes the share of a file.

await client.removeFilePermission(params, options)

Request parameters

Parameter

Type

Required

Description

params

IAddFilePermissionReq

Yes

The request parameters that are used to delete the share of a file.

options

IPDSRequestConfig

No

Other request parameters.

Response parameters

If the share is deleted, no values are returned. Otherwise, an error message is returned.

listFilePermissions method

Queries the permissions on a file.

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

Request parameters

Parameter

Type

Required

Description

params

IListPermissionReq

Yes

The request parameters that are used to query the permissions on a file.

options

IPDSRequestConfig

No

Other request parameters.

IListPermissionReq parameters

Parameter

Type

Required

Description

drive_id

string

Yes

The drive ID.

file_id

string

Yes

The file ID.

Response parameter

Parameter

Type

Required

Description

result

array

Yes

The returned result. For more information, see the following table.

IPermissionStandard parameters

Parameter

Type

Required

Description

identity

object

Yes

The identity of the user who has permissions on the file. This parameter contains the identity_name, identity_type, and identity_id fields.

expire_time

number

Yes

The time when the file expires. The value is a UNIX timestamp.

role_id

string

Yes

The role ID.

disinherit_sub_group

boolean

Yes

Indicates whether the subgroups are inherited.