Signature

global static void createContentVersionBatch(
  List<Types.CreateContentVersionBatchPayload> inputs,
  String runAs
)
Parameters
ParameterDescription
inputs requiredList of Types.CreateContentVersionBatchPayload — one entry per file batch payload.
runAs
String
optionalEmail ID of the user on whose behalf the function should run. Provide integrationUser to run as the automation user. For CloudFiles internal use only — it does not affect the content version or content document created by this action in Salesforce.

Return Type

void. The files are created in the background. When they are ready, CloudFiles publishes a Content Version Created Batch event, carried as ContentVersionCreatedBatch, with the Ids of the new content versions.

Example

cldfs.CreateContentVersionFlowInput file = new cldfs.CreateContentVersionFlowInput();
file.library = 'sharepoint'; //Library
file.driveId = 'b!nJBtPq_z5UeJtFrj_f24XEQqlPUD8vtFsg7GBcrXJepiUn9bkb_7QbDPtqHVD-cP'; //driveId
file.id = '01KEHAKUUSU3E5OUXBBJGLYTD3IZU4BCRV'; //fileId

List<cldfs.CreateContentVersionFlowInput> files = new List<cldfs.CreateContentVersionFlowInput>();
files.add(file);
String context = '{"recordId":"701dL00000WonvTQAR"}';
List<cldfs.Types.CreateContentVersionBatchPayload> inputs = new List<cldfs.Types.CreateContentVersionBatchPayload>{
    new cldfs.Types.CreateContentVersionBatchPayload(
        files,
        context
    )
};
cldfs.Client.createContentVersionBatch(inputs, 'integrationUser');
TestingUse ClientFactory with default mock values to get coverage without callouts. See How to get test coverage of code that uses Client methods.