Methods

After initializing SDK, you will get an object that can be used to call the methods:

const docSpace = DocSpace.SDK.initManager({config})

addTagsToRoom

Adds the specified tags to the room with the specified ID.

docSpace.addTagsToRoom(roomId, tags)
ParameterTypePresenceDescription
roomIdstringrequiredDefines the ID of a room where the tags will be added.
tagsarray of stringsrequiredDefines a list of tags to be added.

createFile

Creates a file with the specified parameters.

docSpace.createFile(folderId, title, templateId, formId)
ParameterTypePresenceDescription
folderIdstringrequiredDefines the ID of a folder where a file will be created.
titlestringrequiredDefines the file title.
templateIdstringoptionalDefines the ID of a template which will be used to create a file.
formIdstringoptionalDefines the ID of a form which will be used to create a file.

createFolder

Creates a folder with the specified parameters.

docSpace.createFolder(parentFolderId, title)
ParameterTypePresenceDescription
parentFolderIdstringrequiredDefines the ID of a parent folder where a folder will be created.
titlestringrequiredDefines the folder title.

createHash

Generates the hash string based on the specified hash settings.

docSpace.createHash(password, hashSettings)
ParameterTypePresenceDescription
passwordstringrequiredDefines a password to the DocSpace account.
hashSettingsobjectrequiredDefines the hash settings for generating the hash string.
hashSettings.sizeintegerrequiredDefines the hash size.
hashSettings.saltstringrequiredDefines the hash salt - a randomly generated set of characters that is added to a password before hashing it.
hashSettings.iterationsintegerrequiredDefines a number of hash iterations.

createRoom

Creates a room with the specified parameters.

docSpace.createRoom(title, type)
ParameterTypePresenceDescription
titlestringrequiredDefines the room title.
typestringrequiredDefines the room type ("CustomRoom", "EditingRoom").

createTag

Creates a tag with the specified name.

docSpace.createTag(name)
ParameterTypePresenceDescription
namestringrequiredDefines the tag name.

destroyFrame

Destroys the SDK frame, replacing it with the element passed to destroyText.

docSpace.destroyFrame()

getConfig

Returns the SDK config.

docSpace.getConfig()

getFiles

Returns the information about all files in the SDK frame.

docSpace.getFiles()

getFolderInfo

Returns the information about the current directory opened in the SDK frame.

docSpace.getFolderInfo()

getFolders

Returns the information about all the folders in the SDK frame.

docSpace.getFolders()

getHashSettings

Returns the DocSpace hash settings for generating a password hash.

docSpace.getHashSettings()

getList

Returns the information about all files and folders in the SDK frame.

docSpace.getList()

getRooms

Returns the information about rooms according to the specified filter parameters.

docSpace.getRooms(filter)
ParameterTypePresenceDescription
filterobjectrequiredThe room filter parameters.

getSelection

Returns the information about the selected elements in the SDK frame.

docSpace.getSelection()

getUserInfo

Returns the information about the current DocSpace user or null if there are no authorized users.

docSpace.getUserInfo()

initEditor

Initializes the SDK frame in the "editor" mode.

docSpace.initEditor(config)
ParameterTypePresenceDescription
configobjectrequiredDefines the configuration parameters which describe the behavior and display options of the DocSpace elements.

initFileSelector

Initializes the SDK frame in the "file-selector" mode.

docSpace.initFileSelector(config)
ParameterTypePresenceDescription
configobjectrequiredDefines the configuration parameters which describe the behavior and display options of the DocSpace elements.

initFrame

Initializes the SDK frame dispaying the DocSpace page.

docSpace.initFrame(config)
ParameterTypePresenceDescription
configobjectrequiredDefines the configuration parameters which describe the behavior and display options of the DocSpace elements.

initManager

Initializes the SDK frame in the "manager" mode.

docSpace.initManager(config)
ParameterTypePresenceDescription
configobjectrequiredDefines the configuration parameters which describe the behavior and display options of the DocSpace elements.

initRoomSelector

Initializes the SDK frame in the "room-selector" mode.

docSpace.initRoomSelector(config)
ParameterTypePresenceDescription
configobjectrequiredDefines the configuration parameters which describe the behavior and display options of the DocSpace elements.

initSystem

Initializes the SDK frame in the "system" mode to call system methods. This lightweight frame displays a blank page with the loader.

docSpace.initSystem(config)
ParameterTypePresenceDescription
configobjectrequiredDefines the configuration parameters which describe the behavior and display options of the DocSpace elements.

initViewer

Initializes the SDK frame in the "viewer" mode.

docSpace.initViewer(config)
ParameterTypePresenceDescription
configobjectrequiredDefines the configuration parameters which describe the behavior and display options of the DocSpace elements.

login

Logs in to the DocSpace account using the specified email and password hash.

docSpace.login(email, passwordHash)
ParameterTypePresenceDescription
emailstringrequiredDefines the user email address.
passwordHashstringrequiredDefines a password hash.

logout

Logs out from the DocSpace account of the current user.

docSpace.logout()

openModal

Opens the DocSpace modal window of the specified type.

docSpace.openModal(type)
ParameterTypePresenceDescription
typestringrequiredDefines the DocSpace modal window type ("CreateFile", "CreateFolder", "CreateRoom").

removeTagsFromRoom

Removes the specified tags from the room with the specified ID.

docSpace.removeTagsFromRoom(roomId, tags)
ParameterTypePresenceDescription
roomIdstringrequiredDefines the ID of a room where the tags will be removed.
tagsarray of stringsrequiredDefines a list of tags to be removed.

setConfig

Sets the specified config for the current SDK entity.

docSpace.setConfig(config)
ParameterTypePresenceDescription
configobjectrequiredDefines the configuration parameters which describe the behavior and display options of the DocSpace elements.

setIsLoaded

Disables the loader in the SDK window.

docSpace.setIsLoaded()

setListView

Sets the display of entity lists according to the specified type.

docSpace.setListView(type)
ParameterTypePresenceDescription
typestringrequiredDefines the way elements are arranged in the DocSpace manager ("row", "table", "tile").

Get Help

  • If you have any questions about ONLYOFFICE DocSpace, try the FAQ section first.
  • You can request a feature or report a bug by posting an issue on GitHub.
  • You can also ask our developers on ONLYOFFICE forum (registration required).