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.3.169
Syntax IAsset CreateChildAsset(
Stream fileStream,
IAssetSchema schema,
string assetName,
bool overwriteSameName
)
Function CreateChildAsset (
fileStream As Stream,
schema As IAssetSchema,
assetName As String,
overwriteSameName As Boolean
) As IAsset
IAsset^ CreateChildAsset(
Stream^ fileStream,
IAssetSchema^ schema,
String^ assetName,
bool overwriteSameName
)
abstract CreateChildAsset :
fileStream : Stream *
schema : IAssetSchema *
assetName : string *
overwriteSameName : bool -> IAsset
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:
IAssetNewly created child asset.
Examples
Example of RemoveFolder method in custom hook:
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