Documentation Center

Specifying upload parameters in assembly code

You can also specify upload parameters in your assembly code, at assembly level or class level, by using optional attribute classes.

TcmTargetFolder
Tridion.ContentManager.Templating.Assembly.TcmTargetFolder, to be used on the assembly level, specifies the Content Manager Folder to upload the .NET assembly to. The argument is a string that is the Content Manager URI (unique identifier) or WebDAV URL of the target Folder.
TcmTemplateTitle
Tridion.ContentManager.Templating.Assembly.TcmTemplateTitle, to be used on the assembly level and on the class level:
  • If used on the assembly level, it specifies the name of the Template Building Block that contains the .NET assembly. If it is omitted, the assembly Template Building Block name defaults to the name of the compiled assembly .dll file (which in turn takes its name from the project name).
  • If used on the class level, it specifies the name of the Template Building Block that contains the C# fragment for the call to this specific class. If it is omitted, the C# fragment Template Building Block name defaults to the class name.
TcmTemplateParameterSchema
Tridion.ContentManager.Templating.Assembly.TcmTemplateParameterSchema specifies a Parameter Schema in the form of a string (TCM URI or WebDAV URL) of a Parameters Schema to use in combination with the Template Building Block (for more information, see Creating Parameters Schemas). If omitted, the Template Building Block has no Parameters Schema (and, therefore, no parameters).
TcmDefaultTemplate
Tridion.ContentManager.Templating.Assembly.TcmDefaultTemplate specifies that this class is the default class to execute if the entire assembly is run from a Template Building Block. You can only set this parameter once within an assembly, and the parameter is only useful if your assembly contains multiple classes that implement ITemplate.

Example 1

The following example sets a target Folder:

using Tridion.ContentManager.Templating.Assembly;
[assembly:TcmTargetFolder("tcm:1-24-2")]

Example 2

The following example, inserted at the class level, sets a name for the Template Building Block, specifies a Parameter Schema, and indicates this class to be the default class to execute:

[TcmTemplateTitle("MyTemplateBuildingBlock"), TcmDefaultTemplate, 
TcmTemplateParameterSchema("tcm:1-183-8")]
public class TestTemplateClass : Assembly.ITemplate
{
	public void transform(Engine engine, Package package)
	{
...