All Products
Search
Document Center

Drive and Photo Service:Edit files online

Last Updated:Feb 19, 2025

This topic describes the online file editing feature of Drive and Photo Service. Drive and Photo Service allows you to edit files online in BasicUI provided by Drive and Photo Service. You can also call API operations of Drive and Photo Service to edit files online by referring to this topic.

The online file editing feature is a value-added feature. By default, this feature is disabled for Drive and Photo Service Developer Edition. The super administrator of Drive and Photo Service can log on to the PDS Admin Console and enable the online file editing feature.

You are charged for the value-added features provided by Drive and Photo Service Developer Edition. For more information, see Billable items for value-added features.

Supported file formats

Spreadsheet file format

Text file format

Presentation file format

ET, XLS, XLT, XLSX, XLSM, XLTX, XLTM, and CSV

DOC, DOCX, TXT, DOT, WPS, WPT, DOTX, DOCM, DOTM, and RTF

PPT, PPTX, PPTM, PPSX, PPSM, PPS, POTX, POTM, DPT, and DPS

Limits

  • Up to 365 users can collaboratively edit a file online. If the number of concurrent online users exceeds 50, page stuttering may occur.

  • The file to be edited online can be up to 200 MB in size. If the file size exceeds 200 MB, the online file editing feature is unavailable.

  • Collaboration records are retained for 180 days.

Process and sample code of API calls

1. Process of API calls

版本

Note:

  • You can call an operation to obtain the online editing URL and token, and use the obtained information to access the online editing page.

  • The online editing token has a validity period. If the token expires, you must call an API operation to refresh the token. You can use the office_refresh_token parameter to obtain a new token.

  • The online editing page is accessed based on frontend technology. We recommend that you use the SDK for JavaScript provided by Drive and Photo Service to edit files online. For more information, see the description of the getOfficeEditUrl and refreshOfficeEditToken methods and the example of previewing a file in the documentation of SDK for JavaScript.

2. Obtain an online editing URL

POST /v2/file/get_office_edit_url

Request parameters

Parameter

Position

Type

Required

Description

Authorization

header

String

The access token.

x-share-token

header

String

The share token. You can specify this parameter if you want to share the file. If you specify this parameter, you do not need to specify the Authorization parameter.

drive_id

body

String

No

The drive ID. The drive_id parameter and the share_id parameter are mutually exclusive. You must specify either of them.

share_id

body

String

No

The share ID. You can specify this parameter if you want to share the file. If you specify this parameter, you cannot specify the drive_id parameter.

file_id

body

String

Yes

The ID of the file to be edited.

option

body

JSON

No

The options that are used to control file editing.

Parameters in the option request parameter

Parameter

Position

Type

Required

Description

copy

body

Boolean

No

Specifies whether to allow users to copy the content of the file.

readonly

body

Boolean

No

Specifies whether the file is read-only. If you want to edit the file online, set this parameter to false.

Response parameters

Parameter

Required

Type

Description

edit_url

Yes

String

The online editing URL.

office_access_token

Yes

String

The access token, which is valid for 30 minutes.

office_refresh_token

Yes

String

The refresh token, which is valid for one day.

Sample request

{
	"drive_id": "1",
	"file_id": "xxxxxx",
	"option": {
		"readonly": false,
		"copy": true
	}
}

Sample response

{
	"edit_url": "xxxxxx",
	"office_access_token": "xxxxxx",
	"office_refresh_token": "xxxxxx"
}

3. Refresh the online editing token

POST /v2/file/refresh_office_edit_token

Request parameters

Parameter

Position

Type

Required

Description

Authorization

header

String

The access token.

x-share-token

header

String

The share token. You can specify this parameter if you want to share the file. If you specify this parameter, you do not need to specify the Authorization parameter.

share_id

body

String

No

The share ID. You can specify this parameter if you want to share the file.

office_access_token

body

String

Yes

The access token.

office_refresh_token

body

String

Yes

The refresh token.

Response parameters

Parameter

Required

Type

Description

office_access_token

Yes

String

The new access token, which is valid for 30 minutes.

office_refresh_token

Yes

String

The new refresh token, which is valid for one day.

Sample request

{
	"office_access_token": "xxxxxx",
	"office_refresh_token": "xxxxxx"
}

Sample response

{
	"office_access_token": "xxxxxx",
	"office_refresh_token": "xxxxxx"
}

4. Access the online editing page

The online editing page is accessed based on frontend technology. We recommend that you use the SDK for JavaScript provided by Drive and Photo Service to edit files online. For more information, see the documentation of the SDK for JavaScript.

If you do not use the SDK for JavaScript provided by Drive and Photo Service, you can use the file preview feature of Alibaba Cloud Intelligent Media Management (IMM). For more information, see the description of the SDK for JavaScript provided for the frontend in the IMM User Guide. When you use the SDK for JavaScript provided for the frontend, replace the operation that is used to obtain the token information with the API operation of Drive and Photo Service that is used to obtain an online editing URL, and replace the operation that is used to obtain the refresh token with the API operation of Drive and Photo Service that is used to refresh the online editing token.

FAQ

1. What permissions are required to edit files online?

The online file editing feature of the web client and desktop client requires the update permissions on files.

2. What do I do if I am unable to edit a file though I am authorized to edit files online?

You can perform the following steps to troubleshoot the issue:

1. The online file editing feature is a value-added feature. Check whether this feature is enabled.

2. Check whether the file format is supported by the online file editing feature.

3. Check whether the file size exceeds 200 MB.

4. Contact the super administrator of Drive and Photo Service to perform the following operations: Log on to the Admin Console. In the left-side navigation pane, choose Enterprise Customize > File Settings. On the File Settings page, view the file upload settings. If the format of the file to be edited is not listed in the formats of files that can be uploaded, you cannot edit the file online. If the file size exceeds the upper limit that is specified for a single uploaded file, you cannot save the file that is edited online.