ArcGIS Pro 2.9 API Reference Guide
CreateTemplate(MapMember,String,String,Inspector,String,String[],String[]) Method
Example 

ArcGIS.Desktop.Mapping Namespace > MappingExtensions Class > CreateTemplate Method : CreateTemplate(MapMember,String,String,Inspector,String,String[],String[]) Method
the map member the new template is to be added to.
the template name.
Optional description of the template.
An ArcGIS.Desktop.Editing.Attributes.Inspector object containing default template values.
Optional, If not provided will use the default tool for the map member type. The defaultTool can be specified using daml-id.
Optional. A set of tags.
Optional list of tools to not allow for this template. Tool filters can be specified using daml-id.
Creates a new template using the specified definition. This method must be called on the MCT. Use QueuedTask.Run.
Syntax
Public Overloads Shared Function CreateTemplate( _
   ByVal member As MapMember, _
   ByVal templateName As String, _
   Optional ByVal description As String, _
   Optional ByVal inspector As Inspector, _
   Optional ByVal defaultTool As String, _
   Optional ByVal tags() As String, _
   Optional ByVal toolFilter() As String _
) As EditingTemplate

Parameters

member
the map member the new template is to be added to.
templateName
the template name.
description
Optional description of the template.
inspector
An ArcGIS.Desktop.Editing.Attributes.Inspector object containing default template values.
defaultTool
Optional, If not provided will use the default tool for the map member type. The defaultTool can be specified using daml-id.
tags
Optional. A set of tags.
toolFilter
Optional list of tools to not allow for this template. Tool filters can be specified using daml-id.

Return Value

the newly created template. Null if it cannot be created.
Exceptions
ExceptionDescription
the Template name cannot be empty. And the template name must be unique.
Example
var table = MapView.Active.Map.GetStandaloneTablesAsFlattenedList().FirstOrDefault();
if (table == null)
  return;
QueuedTask.Run(() =>
{
  var tableTemplate = table.GetTemplate("Template1");
  
  var definition = tableTemplate.GetDefinition();
  definition.Description = "New definition";
  definition.Name = "New name";
  //Create new table template using this definition
  table.CreateTemplate(definition);

  //You can also create a new table template using this extension method. You can use this method the same way you use the layer.CreateTemplate method.
  table.CreateTemplate("New template name", "Template description", tags: new string[] { "tag 1", "tag 2" });
});
Requirements

Target Platforms: Windows 11, Windows 10, Windows 8.1

See Also

Reference

MappingExtensions Class
MappingExtensions Members
Overload List