S-Drive 3.6 Documentation

inheritSharings

inheritSharings

Applies a parent folder's sharing to file(s) that were just uploaded into it — so a file lands with the same sharing everyone else already has on that folder, rather than defaulting to just the uploading user's own access.

How to call this method

global static void inheritSharings(List<String> wipIdList, String currentFolderId)

global static void inheritSharings(List<String> wipIdList, String currentFolderId, String customObjectNameAT)

Parameters

Parameter

Type

Required

Description

wipIdList

List<String>

Yes

Ids of the file record(s) to share — the file records that were just uploaded.

currentFolderId

String

Yes

Id of the parent folder to inherit sharing from.

customObjectNameAT

String

No

For a custom file object, the API name of that object's sharing table — its __Share object (e.g. cg__MyCustomFile__Share). If you pass the plain file object name instead (e.g. cg__MyCustomFile__c), it's converted to the __Share name for you. Only needed for custom objects; S-Drive's built-in file objects don't need this.

Return value

Doesn't return anything.

Example

List<String> wipIdList = new List<String>();
wipIdList.add(uploadRequestInfos[0].wipFileId);

cg.SDriveTools.inheritSharings(wipIdList, currentFolderId);