ArcGIS Pro 3.3 API Reference Guide
ArcGIS.Desktop.Mapping Namespace / MappingExtensions Class / CreateTemplate Method / CreateTemplate(MapMember,CIMEditingTemplate) Method
The map member the new template is to be added to.
The template definition.
Example

In This Topic
    CreateTemplate(MapMember,CIMEditingTemplate) Method
    In This Topic
    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 mapMember As MapMember, _
       ByVal templateDef As CIMEditingTemplate _
    ) As EditingTemplate

    Parameters

    mapMember
    The map member the new template is to be added to.
    templateDef
    The template definition.

    Return Value

    The newly created template. Null if it cannot be created.
    Example
    Create New Table Template using table.CreateTemplate
    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

    ArcGIS Pro version: 3 or higher.
    See Also