Search Results for

    Show / Hide Table of Contents
    View Source

    Interface ITemplateService

    Namespace: Umbraco.Cms.Core.Services
    Assembly: Umbraco.Core.dll
    Syntax
    public interface ITemplateService : IService

    Methods

    View Source

    CreateAsync(String, String, String, Guid, Nullable<Guid>)

    Creates a new template

    Declaration
    Task<Attempt<ITemplate, TemplateOperationStatus>> CreateAsync(string name, string alias, string content, Guid userKey, Guid? templateKey = null)
    Parameters
    Type Name Description
    System.String name

    Name of the new template

    System.String alias

    Alias of the template

    System.String content

    View content for the new template

    Guid userKey

    Key of the user performing the Create.

    System.Nullable<Guid> templateKey
    Returns
    Type Description
    Task<Attempt<ITemplate, TemplateOperationStatus>>
    View Source

    CreateAsync(ITemplate, Guid)

    Creates a new template

    Declaration
    Task<Attempt<ITemplate, TemplateOperationStatus>> CreateAsync(ITemplate template, Guid userKey)
    Parameters
    Type Name Description
    ITemplate template

    The new template

    Guid userKey

    Key of the user performing the Create.

    Returns
    Type Description
    Task<Attempt<ITemplate, TemplateOperationStatus>>
    View Source

    CreateForContentTypeAsync(String, String, Guid)

    Creates a template for a content type

    Declaration
    Task<Attempt<ITemplate, TemplateOperationStatus>> CreateForContentTypeAsync(string contentTypeAlias, string contentTypeName, Guid userKey)
    Parameters
    Type Name Description
    System.String contentTypeAlias
    System.String contentTypeName
    Guid userKey

    Key of the user performing the Create.

    Returns
    Type Description
    Task<Attempt<ITemplate, TemplateOperationStatus>>

    The template created

    View Source

    DeleteAsync(Guid, Guid)

    Deletes a template by its key

    Declaration
    Task<Attempt<ITemplate, TemplateOperationStatus>> DeleteAsync(Guid key, Guid userKey)
    Parameters
    Type Name Description
    Guid key

    Key of the ITemplate to delete

    Guid userKey

    Key of the user performing the Delete.

    Returns
    Type Description
    Task<Attempt<ITemplate, TemplateOperationStatus>>

    True if the template was deleted, false otherwise

    View Source

    DeleteAsync(String, Guid)

    Deletes a template by its alias

    Declaration
    Task<Attempt<ITemplate, TemplateOperationStatus>> DeleteAsync(string alias, Guid userKey)
    Parameters
    Type Name Description
    System.String alias

    Alias of the ITemplate to delete

    Guid userKey

    Key of the user performing the Delete.

    Returns
    Type Description
    Task<Attempt<ITemplate, TemplateOperationStatus>>

    True if the template was deleted, false otherwise

    View Source

    GetAllAsync(Guid[])

    Gets a list of all ITemplate objects

    Declaration
    Task<IEnumerable<ITemplate>> GetAllAsync(Guid[] keys)
    Parameters
    Type Name Description
    Guid[] keys
    Returns
    Type Description
    Task<IEnumerable<ITemplate>>

    An enumerable list of ITemplate.

    View Source

    GetAllAsync(String[])

    Gets a list of all ITemplate objects

    Declaration
    Task<IEnumerable<ITemplate>> GetAllAsync(params string[] aliases)
    Parameters
    Type Name Description
    System.String[] aliases
    Returns
    Type Description
    Task<IEnumerable<ITemplate>>

    An enumerable list of ITemplate.

    View Source

    GetAsync(Guid)

    Gets a ITemplate object by its guid identifier.

    Declaration
    Task<ITemplate> GetAsync(Guid id)
    Parameters
    Type Name Description
    Guid id

    The guid identifier of the template.

    Returns
    Type Description
    Task<ITemplate>

    The ITemplate object matching the identifier, or null.

    View Source

    GetAsync(Int32)

    Gets a ITemplate object by its identifier.

    Declaration
    Task<ITemplate> GetAsync(int id)
    Parameters
    Type Name Description
    System.Int32 id

    The identifier of the template.

    Returns
    Type Description
    Task<ITemplate>

    The ITemplate object matching the identifier, or null.

    View Source

    GetAsync(String)

    Gets a ITemplate object by its alias.

    Declaration
    Task<ITemplate> GetAsync(string alias)
    Parameters
    Type Name Description
    System.String alias

    The alias of the template.

    Returns
    Type Description
    Task<ITemplate>

    The ITemplate object matching the alias, or null.

    View Source

    GetChildrenAsync(Int32)

    Gets a list of all ITemplate objects

    Declaration
    Task<IEnumerable<ITemplate>> GetChildrenAsync(int masterTemplateId)
    Parameters
    Type Name Description
    System.Int32 masterTemplateId
    Returns
    Type Description
    Task<IEnumerable<ITemplate>>

    An enumerable list of ITemplate objects

    View Source

    GetDescendantsAsync(Int32)

    Gets the template descendants

    Declaration
    Task<IEnumerable<ITemplate>> GetDescendantsAsync(int masterTemplateId)
    Parameters
    Type Name Description
    System.Int32 masterTemplateId
    Returns
    Type Description
    Task<IEnumerable<ITemplate>>
    View Source

    GetFileContentStreamAsync(String)

    Gets the content of a template as a stream.

    Declaration
    Task<Stream> GetFileContentStreamAsync(string filepath)
    Parameters
    Type Name Description
    System.String filepath

    The filesystem path to the template.

    Returns
    Type Description
    Task<Stream>

    The content of the template.

    View Source

    GetFileSizeAsync(String)

    Gets the size of a template.

    Declaration
    Task<long> GetFileSizeAsync(string filepath)
    Parameters
    Type Name Description
    System.String filepath

    The filesystem path to the template.

    Returns
    Type Description
    Task<System.Int64>

    The size of the template.

    View Source

    SetFileContentAsync(String, Stream)

    Sets the content of a template.

    Declaration
    Task SetFileContentAsync(string filepath, Stream content)
    Parameters
    Type Name Description
    System.String filepath

    The filesystem path to the template.

    Stream content

    The content of the template.

    Returns
    Type Description
    Task
    View Source

    UpdateAsync(ITemplate, Guid)

    Updates a ITemplate

    Declaration
    Task<Attempt<ITemplate, TemplateOperationStatus>> UpdateAsync(ITemplate template, Guid userKey)
    Parameters
    Type Name Description
    ITemplate template

    ITemplate to update

    Guid userKey

    Key of the user saving the template

    Returns
    Type Description
    Task<Attempt<ITemplate, TemplateOperationStatus>>
    • Improve this Doc
    • View Source
    In This Article
    • Methods
      • CreateAsync(String, String, String, Guid, Nullable<Guid>)
      • CreateAsync(ITemplate, Guid)
      • CreateForContentTypeAsync(String, String, Guid)
      • DeleteAsync(Guid, Guid)
      • DeleteAsync(String, Guid)
      • GetAllAsync(Guid[])
      • GetAllAsync(String[])
      • GetAsync(Guid)
      • GetAsync(Int32)
      • GetAsync(String)
      • GetChildrenAsync(Int32)
      • GetDescendantsAsync(Int32)
      • GetFileContentStreamAsync(String)
      • GetFileSizeAsync(String)
      • SetFileContentAsync(String, Stream)
      • UpdateAsync(ITemplate, Guid)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX