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.5.94
Syntax
IAsset CreateChildAsset(
	Stream fileStream,
	IAssetSchema schema,
	string assetName,
	bool overwriteSameName
)

Parameters

fileStream
Type: System.IOStream
The Stream of the file to associate with the new asset.
schema
Type: Ingeniux.CMSIAssetSchema
Schema to be used to create the child asset. If not specified, an error will be thrown.
assetName
Type: SystemString
Name of the new child asset to create.
overwriteSameName
Type: SystemBoolean
Whether an asset already existing within the context asset folder should be replaced with the new asset.

Return Value

Type: IAsset
Newly created child asset.
Examples
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