Click or drag to resize

IAssetFolderCreateChildAsset Method


Creates a new child asset under the context asset folder.

Namespace: Ingeniux.CMS
Assembly: Ingeniux.CMS.CSAPI (in Ingeniux.CMS.CSAPI.dll) Version: 10.6.492
Syntax
IAsset CreateChildAsset(
	Stream fileStream,
	IAssetSchema schema,
	string assetName,
	bool overwriteSameName
)

Parameters

fileStream  Stream
The Stream of the file to associate with the new asset.
schema  IAssetSchema
Schema to be used to create the child asset. If not specified, an error will be thrown.
assetName  String
Name of the new child asset to create.
overwriteSameName  Boolean
Whether an asset already existing within the context asset folder should be replaced with the new asset.

Return Value

IAsset
Newly created child asset.
Example
Example of RemoveFolder method in custom hook:
C#
int outVar;
var exampleThumbStream = session.Site.Asset("a/100").Stream();
IAssetSchema thumbSchema = exampleThumbStream.Schema;
IAssetFolder baseFolder = session.Site.AssetFolder("af/5");
foreach(IAssetFolder folder in baseFolder.DescendantFolders(out outVar).Where(f => f.Name == "Thumbnails")){
   folder.CreateChildAsset(exampleThumbStream, thumbSchema, "ExampleThumb", true);
}
See Also