Function API only Updated 17 Oct 2026
addFileShare(file, user, access, [message])
Creates a new share / overwrites existing for a specific file and user, and sends an invitation email to the specified user.
Parameters
filestringrequiredPath to the file to share, from the site root.
userstring (email)requiredEmail of the user. Several emails can be given.
accessstringrequiredA string with letters describing the access level:
R - read (read in Docly and on websites)
M - modify (W also allowed) - requires R
V - Visit (web site read access only "Visit")
Example: "RM" meaning read and modify
messagestringoptionalOptional message to send to user
Returns
true for success, otherwise throws an error — for example when the file is not found (error 1), or only exists in the app the site is published from (error 110). The call runs as the site's publisher.
Example
Normal JavaScript, running in the browser or on the Docly™ server.
docly.addFileShare("test file", "test@docly.net", "V", "Access granted to view file");