跳到主要内容

Basic samples

These samples each demonstrate a single ONLYOFFICE Apps Embed SDK mode or method in isolation. Use them as a quick reference before combining several calls into a real integration, like the ones in Advanced samples.

Not every SDK method has a dedicated sample yet. For the complete list, see the SDK reference for the init methods and the SDKInstance reference for the instance methods.

Authentication and session​

SampleDescription
Create password hashGenerate a password hash using the ONLYOFFICE Apps JS SDK.
LoginLog in to ONLYOFFICE Apps using the JS SDK with password hashing.
LogoutLog out a user from the ONLYOFFICE Apps session using the JS SDK.
Get hash settingsRetrieve hash settings from the ONLYOFFICE Apps frame using the JS SDK.
Get user infoRetrieve user information using the ONLYOFFICE Apps JS SDK.

Frame initialization​

SampleDescription
Initialize frameInitialize an ONLYOFFICE Apps frame in the mode set by the mode config field.
Initialize managerInitialize the ONLYOFFICE Apps manager using the JS SDK.
Initialize editorOpen a document in the ONLYOFFICE Apps editor using the JS SDK.
Initialize viewerEmbed a read-only document viewer using the JS SDK.
Initialize file selectorInitialize the ONLYOFFICE Apps file selector using the JS SDK.
Initialize room selectorEmbed the room selection interface using the JS SDK.
Initialize systemInitialize the ONLYOFFICE Apps system interface using the JS SDK.
Destroy frameRemove the embedded ONLYOFFICE Apps iframe using the JS SDK.
Mark iframe as loadedMark the ONLYOFFICE Apps iframe as loaded using the JS SDK.

Frame configuration and UI​

SampleDescription
Get configRetrieve the embedded frame configuration using the JS SDK.
Set configUpdate the embedded frame configuration using the JS SDK.
Set list viewChange the file list display mode using the JS SDK.
Open modalOpen a modal window in ONLYOFFICE Apps using the JS SDK.
Get selectionRetrieve the current selection in ONLYOFFICE Apps using the JS SDK.

Rooms and folders​

SampleDescription
Create roomCreate a new shared room using the ONLYOFFICE Apps JS SDK.
Get roomsRetrieve available rooms using the ONLYOFFICE Apps JS SDK.
Create folderCreate a folder in an ONLYOFFICE Apps room using the JS SDK.
Get foldersRetrieve a list of folders from a room using the JS SDK.
Get folder infoRetrieve current folder information using the JS SDK.

Files​

SampleDescription
Create fileCreate a new file inside an ONLYOFFICE Apps room using the JS SDK.
Get filesRetrieve a list of files from a room using the JS SDK.
Get files and folders listRetrieve files and folders from a room using the JS SDK.

Tags​

SampleDescription
Create tagCreate a custom tag in ONLYOFFICE Apps using the JS SDK.
Add tags to roomAdd custom tags to an ONLYOFFICE Apps room using the JS SDK.
Remove tags from roomRemove tags from an ONLYOFFICE Apps room using the JS SDK.