IAssetFolderCreateChildAsset Method
|
Creates a new child asset under the context asset folder.
Namespace: Ingeniux.CMSAssembly: Ingeniux.CMS.CSAPI (in Ingeniux.CMS.CSAPI.dll) Version: 10.6.492
SyntaxIAsset 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 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
IAssetNewly created child asset.
Example
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