Newer Version Available

This content describes an older version of this product. View Latest

File Shares

Returns information about the objects with which the specified file has been shared. Objects can be users, groups, or records. Can also be used to share the specified file with users.
Resource
1/connect/files/fileId/file-shares
1/connect/communities/communityId/files/fileId/file-shares
Available since version
36.0
In versions 24.0–35.0, use /chatter/files/fileId/file-shares and /connect/communities/communityId/chatter/files/fileId/file-shares, which require Chatter.
Requires Chatter
No
HTTP methods
GET, HEAD, POST

POST is available in versions 30.0 and later.

Request parameters for GET
In versions 30.0 and later, the first share returned in a GET request is the organization record share. In communities, the first share returned is the network record share.
Name Type Description Required or Optional Available Since
page Integer An integer greater than 0 specifying a page of topics. The default value is zero. Optional 24.0
pageSize Integer Specifies the number of items per page. Valid values are from 1 to 100. The default value is 25. Optional 24.0
Request body for POST
Root XML tag
<fileShares>
JSON example
1{
2  "message": "I shared a document with you.",
3  "shares": [
4     { "id": "005D0000001Az4l", "sharingType": "V" },
5     { "id": "005D0000001B2ny", "sharingType": "C" }
6   ]
7}
Properties
Name Type Description Available Version
message String Private message body that’s sent to the recipients. If Salesforce Communities is enabled, an email is sent instead of a private message. 30.0
shares Share Input[] Collection of Share Input request bodies 30.0
Request parameters for POST
Parameters for sharing a file with users
Name Type Description Required or Optional Available Since
id(1–9) String List of up to 9 user IDs to share this file with. This list must match the list of sharing types. Required 30.0
message String Private message body that’s sent to the recipients. If Salesforce Communities is enabled, an email is sent instead of a private message. Optional 30.0
sharingType(1–9) String List of sharing types, either C for collaborator or V for viewer. This list must match the list of user IDs. Required 30.0
Response body for GET and POST
File Shares Page
Example for POST
This example uses request parameters to share a file with two users.
1POST /connect/files/069D00000001JDU/file-shares?​id1=005D0000001LL8O&id2=005D0000001QdEL&sharingType1=C&sharingType2=V
Here is the same example using a request body.
1POST /connect/files/069D00000001JDU/file-shares
2
3{
4  "shares": [
5     { "id": "005D0000001LL8O", "sharingType": "C" },
6     { "id": "005D0000001QdEL", "sharingType": "V" }
7   ]
8}