- Home [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
- Getting started
- Use cases
-
API
-
Object types
- DispositionType
- ProcessInstanceState
- ProcessTaskState
- ApplicationItemRegistration
- ApplicationProjectItem
- ApplicationProjectItemRef
- ApplicationProjectPlanElementItem
- ApplicationProjectPlanElementItemRef
- BaseApplicationItem
- BaseApplicationItemRef
- BaseItem
- BaseItemData
- CurrentUserItem
- DirectoryData
- DirectoryItem
- EmployeeItemData
- EmployeeItemParams
- EmployeeItemProcesses
- FileData
- FileItem
- FileItemRef
- FileVersionData
- FileVersionItem
- ImageData
- ImageItem
- ImageItemRef
- InstanceAddr
- Item
- ItemData
- ItemRef
- MailMessageData
- MailMessageItem
- MailMessageItemRef
- OrganisationStructureData
- OrganisationStructureItem
- OrganisationStructureItemRef
- ParamsItem
- ProcessInstanceData
- ProcessInstanceItem
- ProcessInstanceItemRef
- ProcessTaskData
- ProcessTaskItem
- ProcessTaskItemRef
- ProcessTemplate
- ProcessTimer
- ReminderData
- ReminderItem
- ReplacementData
- ReplacementItem
- StatusHistoryData
- StatusHistoryItem
- StatusHistoryItemRef
- TaskItemExit
- UserData
- UserGroupData
- UserGroupItem
- UserGroupItemRef
- UserItem
- UserItemRef
- ApplicationItem
- ApplicationItemRef
- Data types
- Global constants
- Work with apps
- Web requests
- Access permissions
- Document flow
- Live Chats
- “Code” widget
- Signatures
- Business calendars
- Integration with IP telephony
- Integration with email marketing services
-
Object types
Link to file
Doesn't store all the file's data, but allows using a set of the file's methods
Type parameters
I: Item<ItemData>
Hierarchy
Properties
Readonly code
App code of the URL’s target (the app’s code).
Readonly id
ID of the URL’s target.
Readonly namespace
Namespace of the URL target (the code of the workspace that the app belongs to).
Methods
fetch
Request complete data of a reference object.
Returns Promise<FileItem>
getDownloadUrl
The method returns a link to download a file’s content.
The URL can be used to get the file’s content. Using this link, even anonymous users can download the file. The download link is active for one hour. You can set how the file will be displayed, as an attachment or inline. The default value of the
dispositionType
parameter isattachment
.const url = await file.getDownloadUrl();
Parameters
Optional dispositionType: DispositionType
Returns Promise<string>
getFileMD5Hash
The method gets the MD5 hash of the file.
In the example, the context includes the
file
field. It’s a file from the system.const hash = await file.getFileMD5Hash();
Returns Promise<string>
getPermissions
The method receives a file’s permissions.
After a successful permissions request, you will get a TPermissions object. This object can be modified or analyzed for various permission checks.
const perm = await file.getPermissions();
Returns Promise<TPermissions>
getStaticDownloadUrl
The method returns a permanent link to download a file’s content.
The returned link contains a redirect to the link with the file’s content. This link can be used only by authorized users who have sufficient permissions to download the file. The attachment type can be
attachment
orinline
. By default, thedispositionType
parameter is set toattachment
. The link is permanent. It exists until the file is deleted in the system.// Get the file’s ID const fileUUID = Context. data.fileID; if(!fileUUID) { return; } // Search for the file const file = await System.files.search().where(x => x.__id.eq(fileUUID)).first(); if(!file) { return; } // Get a permanent link to the file const url = file.getStaticDownloadUrl();
Parameters
Optional dispositionType: DispositionType
Returns string
hasPermission
The method checks access permissions PermissionType.
The method allows you to easily check whether it is possible to perform a PermissionType operation with a file. The method returns a flag. If its value is
true
, the user can perform the requested operation with the file. It is also possible to check access permissions for an org chart item.const user = Context.data.__createdBy; const canUpdate = await file.hasPermission(user, PermissionType.UPDATE);
Parameters
group: TPermissionOrgunit
type: PermissionType
Returns Promise<boolean>
setPermissions
The method sets access permissions for a file.
This method is used when you need to change a file’s access settings by adding or deleting access permissions for a user, a group, or an org chart item. To add new access permissions, use the TPermissionValue object. To grant access to specific operations, use PermissionType. When a new TPermissions object is created, use the FileItem.setPermissions method to save the new access permissions.
const user = Context.data.__createdBy; const permissions = new Permissions([ new PermissionValue(user, [PermissionType.DELETE, PermissionType.READ]), ]); await file.setPermissions(perms);
Parameters
perms: TPermissions
Returns Promise<void>
Properties
Methods