Signature

global static void createDataset(
  List<Types.CreateDatasetInput> datasetInputs,
  String runAs
)
Parameters
ParameterDescription
datasetInputs requiredOne entry per dataset to create. Each Types.CreateDatasetInput names the dataset and lists its files.
runAs
String
optionalEmail Id of the user on whose behalf the function should run. To run the action as the automation user, supply integrationUser.

Return Type

void. The dataset is created in the background. When it is ready, CloudFiles publishes a Dataset Created event carrying the new dataset Id and your context. Query it with Query Document.

Example

List<cldfs.Resource> files = new List<cldfs.Resource>{
  new cldfs.Resource('01KEHAKUXCQ6YIOFLOPJHJN57Y5EYQTJMZ', 'file', null, 'sharepoint', 'b!nJBtPq_z5UeJtFrj_f24XEQqlPUD8vtFsg7GBcrXJepiUn9bkb_7QbDPtqHVD-cP'),
  new cldfs.Resource('01KEHAKUQ4HW7VGNGBYVFJ3F2ZB2NNO5QX', 'file', null, 'sharepoint', 'b!nJBtPq_z5UeJtFrj_f24XEQqlPUD8vtFsg7GBcrXJepiUn9bkb_7QbDPtqHVD-cP')
};

List<cldfs.Types.CreateDatasetInput> inputs = new List<cldfs.Types.CreateDatasetInput>{
  new cldfs.Types.CreateDatasetInput(
    'Supplier contracts 2026', // name
    'Signed supplier contracts for this year', // description
    files,
    '006dL000005H4srQAC' // context, returned on the Dataset Created event
  )
};

cldfs.Client.createDataset(inputs, 'integrationUser');
Building on an existing datasetPass the Id of an existing dataset as datasetId (the five-argument constructor) to create a new dataset that holds the existing dataset's sources plus the files you list. The existing dataset is not changed. If no dataset has that Id, the dataset is not created.