Search Results for

    Show / Hide Table of Contents
    View Source

    Interface IFileService

    Defines the File Service, which is an easy access to operations involving IFile objects like Scripts, Stylesheets and Templates

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

    Methods

    View Source

    CreatePartialView(IPartialView, string?, int?)

    Creates a new IPartialView.

    Declaration
    [Obsolete("Please use IPartialViewService for partial view operations. Scheduled for removal in Umbraco 18.")]
    Attempt<IPartialView?> CreatePartialView(IPartialView partialView, string? snippetName = null, int? userId = -1)
    Parameters
    Type Name Description
    IPartialView partialView

    The IPartialView to create.

    string snippetName

    Optional name of a snippet to use as template content.

    int? userId

    Optional id of the user creating the partial view.

    Returns
    Type Description
    Attempt<IPartialView>

    An Attempt<TResult> indicating success or failure with the created partial view.

    View Source

    CreatePartialViewFolder(string)

    Creates a folder for partial views.

    Declaration
    [Obsolete("Please use IPartialViewFolderService for partial view folder operations. Scheduled for removal in Umbraco 18.")]
    void CreatePartialViewFolder(string folderPath)
    Parameters
    Type Name Description
    string folderPath

    The path of the folder to create.

    View Source

    CreateScriptFolder(string)

    Creates a folder for scripts

    Declaration
    [Obsolete("Please use IScriptFolderService for script folder operations. Scheduled for removal in Umbraco 18.")]
    void CreateScriptFolder(string folderPath)
    Parameters
    Type Name Description
    string folderPath
    View Source

    CreateStyleSheetFolder(string)

    Creates a folder for style sheets

    Declaration
    [Obsolete("Please use IStylesheetFolderService for stylesheet folder operations. Scheduled for removal in Umbraco 18.")]
    void CreateStyleSheetFolder(string folderPath)
    Parameters
    Type Name Description
    string folderPath
    View Source

    CreateTemplateForContentType(string, string?, int)

    Creates a template for a content type

    Declaration
    [Obsolete("Please use ITemplateService for template operations. Scheduled for removal in Umbraco 18.")]
    Attempt<OperationResult<OperationResultType, ITemplate>?> CreateTemplateForContentType(string contentTypeAlias, string? contentTypeName, int userId = -1)
    Parameters
    Type Name Description
    string contentTypeAlias
    string contentTypeName
    int userId
    Returns
    Type Description
    Attempt<OperationResult<OperationResultType, ITemplate>>

    The template created

    View Source

    CreateTemplateWithIdentity(string?, string?, string?, ITemplate?, int)

    Creates a new template with identity, setting the content if a view exists in the filesystem.

    Declaration
    [Obsolete("Please use ITemplateService for template operations. Scheduled for removal in Umbraco 18.")]
    ITemplate CreateTemplateWithIdentity(string? name, string? alias, string? content, ITemplate? masterTemplate = null, int userId = -1)
    Parameters
    Type Name Description
    string name

    The name of the template.

    string alias

    The alias of the template.

    string content

    The content/markup of the template.

    ITemplate masterTemplate

    Optional master template.

    int userId

    Optional id of the user creating the template.

    Returns
    Type Description
    ITemplate

    The created ITemplate.

    View Source

    DeletePartialView(string, int?)

    Deletes a partial view by its path.

    Declaration
    [Obsolete("Please use IPartialViewService for partial view operations. Scheduled for removal in Umbraco 18.")]
    bool DeletePartialView(string path, int? userId = null)
    Parameters
    Type Name Description
    string path

    The path of the partial view to delete.

    int? userId

    Optional id of the user deleting the partial view.

    Returns
    Type Description
    bool

    True if the partial view was deleted; otherwise, false.

    View Source

    DeletePartialViewFolder(string)

    Deletes a folder for partial views.

    Declaration
    [Obsolete("Please use IPartialViewFolderService for partial view folder operations. Scheduled for removal in Umbraco 18.")]
    void DeletePartialViewFolder(string folderPath)
    Parameters
    Type Name Description
    string folderPath

    The path of the folder to delete.

    View Source

    DeleteScript(string, int?)

    Deletes a script by its name

    Declaration
    [Obsolete("Please use IScriptService for script operations. Scheduled for removal in Umbraco 18.")]
    void DeleteScript(string path, int? userId = null)
    Parameters
    Type Name Description
    string path

    Name incl. extension of the Script to delete

    int? userId

    Optional id of the user deleting the script

    View Source

    DeleteScriptFolder(string)

    Deletes a folder for scripts

    Declaration
    [Obsolete("Please use IScriptFolderService for script folder operations. Scheduled for removal in Umbraco 18.")]
    void DeleteScriptFolder(string folderPath)
    Parameters
    Type Name Description
    string folderPath
    View Source

    DeleteStyleSheetFolder(string)

    Deletes a folder for style sheets

    Declaration
    [Obsolete("Please use IStylesheetFolderService for stylesheet folder operations. Scheduled for removal in Umbraco 18.")]
    void DeleteStyleSheetFolder(string folderPath)
    Parameters
    Type Name Description
    string folderPath
    View Source

    DeleteStylesheet(string, int?)

    Deletes a stylesheet by its name

    Declaration
    [Obsolete("Please use IStylesheetService for stylesheet operations. Scheduled for removal in Umbraco 18.")]
    void DeleteStylesheet(string path, int? userId = null)
    Parameters
    Type Name Description
    string path

    Name incl. extension of the Stylesheet to delete

    int? userId

    Optional id of the user deleting the stylesheet

    View Source

    DeleteTemplate(string, int)

    Deletes a template by its alias

    Declaration
    [Obsolete("Please use ITemplateService for template operations. Scheduled for removal in Umbraco 18.")]
    void DeleteTemplate(string alias, int userId = -1)
    Parameters
    Type Name Description
    string alias

    Alias of the ITemplate to delete

    int userId

    Optional id of the user deleting the template

    View Source

    GetPartialView(string)

    Gets a IPartialView object by its path.

    Declaration
    [Obsolete("Please use IPartialViewService for partial view operations. Scheduled for removal in Umbraco 18.")]
    IPartialView? GetPartialView(string path)
    Parameters
    Type Name Description
    string path

    The path of the partial view.

    Returns
    Type Description
    IPartialView

    The IPartialView object matching the path, or null.

    View Source

    GetPartialViewFileContentStream(string)

    Gets the content of a partial view as a stream.

    Declaration
    [Obsolete("Please use IPartialViewService for partial view operations. Scheduled for removal in Umbraco 18.")]
    Stream GetPartialViewFileContentStream(string filepath)
    Parameters
    Type Name Description
    string filepath

    The filesystem path to the partial view.

    Returns
    Type Description
    Stream

    The content of the partial view.

    View Source

    GetPartialViewFileSize(string)

    Gets the size of a partial view.

    Declaration
    [Obsolete("Please use IPartialViewService for partial view operations. Scheduled for removal in Umbraco 18.")]
    long GetPartialViewFileSize(string filepath)
    Parameters
    Type Name Description
    string filepath

    The filesystem path to the partial view.

    Returns
    Type Description
    long

    The size of the partial view.

    View Source

    GetPartialViews(params string[])

    Gets a list of all IPartialView objects

    Declaration
    [Obsolete("Please use IPartialViewService for partial view operations. Scheduled for removal in Umbraco 18.")]
    IEnumerable<IPartialView> GetPartialViews(params string[] names)
    Parameters
    Type Name Description
    string[] names
    Returns
    Type Description
    IEnumerable<IPartialView>

    An enumerable list of IPartialView objects

    View Source

    GetScript(string?)

    Gets a IScript object by its name

    Declaration
    [Obsolete("Please use IScriptService for script operations. Scheduled for removal in Umbraco 18.")]
    IScript? GetScript(string? name)
    Parameters
    Type Name Description
    string name

    Name of the script incl. extension

    Returns
    Type Description
    IScript

    A IScript object

    View Source

    GetScriptFileContentStream(string)

    Gets the content of a script file as a stream.

    Declaration
    [Obsolete("Please use IScriptService for script operations. Scheduled for removal in Umbraco 18.")]
    Stream GetScriptFileContentStream(string filepath)
    Parameters
    Type Name Description
    string filepath

    The filesystem path to the script.

    Returns
    Type Description
    Stream

    The content of the script file.

    View Source

    GetScriptFileSize(string)

    Gets the size of a script file.

    Declaration
    [Obsolete("Please use IScriptService for script operations. Scheduled for removal in Umbraco 18.")]
    long GetScriptFileSize(string filepath)
    Parameters
    Type Name Description
    string filepath

    The filesystem path to the script file.

    Returns
    Type Description
    long

    The size of the script file.

    View Source

    GetScripts(params string[])

    Gets a list of all IScript objects

    Declaration
    [Obsolete("Please use IScriptService for script operations. Scheduled for removal in Umbraco 18.")]
    IEnumerable<IScript> GetScripts(params string[] names)
    Parameters
    Type Name Description
    string[] names
    Returns
    Type Description
    IEnumerable<IScript>

    An enumerable list of IScript objects

    View Source

    GetStylesheet(string?)

    Gets a IStylesheet object by its name

    Declaration
    [Obsolete("Please use IStylesheetService for stylesheet operations. Scheduled for removal in Umbraco 18.")]
    IStylesheet? GetStylesheet(string? path)
    Parameters
    Type Name Description
    string path

    Path of the stylesheet incl. extension

    Returns
    Type Description
    IStylesheet

    A IStylesheet object

    View Source

    GetStylesheetFileContentStream(string)

    Gets the content of a stylesheet as a stream.

    Declaration
    [Obsolete("Please use IStylesheetService for stylesheet operations. Scheduled for removal in Umbraco 18.")]
    Stream GetStylesheetFileContentStream(string filepath)
    Parameters
    Type Name Description
    string filepath

    The filesystem path to the stylesheet.

    Returns
    Type Description
    Stream

    The content of the stylesheet.

    View Source

    GetStylesheetFileSize(string)

    Gets the size of a stylesheet.

    Declaration
    [Obsolete("Please use IStylesheetService for stylesheet operations. Scheduled for removal in Umbraco 18.")]
    long GetStylesheetFileSize(string filepath)
    Parameters
    Type Name Description
    string filepath

    The filesystem path to the stylesheet.

    Returns
    Type Description
    long

    The size of the stylesheet.

    View Source

    GetStylesheets(params string[])

    Gets a list of all IStylesheet objects

    Declaration
    [Obsolete("Please use IStylesheetService for stylesheet operations. Scheduled for removal in Umbraco 18.")]
    IEnumerable<IStylesheet> GetStylesheets(params string[] paths)
    Parameters
    Type Name Description
    string[] paths
    Returns
    Type Description
    IEnumerable<IStylesheet>

    An enumerable list of IStylesheet objects

    View Source

    GetTemplate(Guid)

    Gets a ITemplate object by its guid identifier.

    Declaration
    [Obsolete("Please use ITemplateService for template operations. Scheduled for removal in Umbraco 18.")]
    ITemplate? GetTemplate(Guid id)
    Parameters
    Type Name Description
    Guid id

    The guid identifier of the template.

    Returns
    Type Description
    ITemplate

    The ITemplate object matching the identifier, or null.

    View Source

    GetTemplate(int)

    Gets a ITemplate object by its identifier.

    Declaration
    [Obsolete("Please use ITemplateService for template operations. Scheduled for removal in Umbraco 18.")]
    ITemplate? GetTemplate(int id)
    Parameters
    Type Name Description
    int id

    The identifier of the template.

    Returns
    Type Description
    ITemplate

    The ITemplate object matching the identifier, or null.

    View Source

    GetTemplate(string?)

    Gets a ITemplate object by its alias.

    Declaration
    [Obsolete("Please use ITemplateService for template operations. Scheduled for removal in Umbraco 18.")]
    ITemplate? GetTemplate(string? alias)
    Parameters
    Type Name Description
    string alias

    The alias of the template.

    Returns
    Type Description
    ITemplate

    The ITemplate object matching the alias, or null.

    View Source

    GetTemplateDescendants(int)

    Gets the template descendants

    Declaration
    [Obsolete("Please use ITemplateService for template operations. Scheduled for removal in Umbraco 18.")]
    IEnumerable<ITemplate> GetTemplateDescendants(int masterTemplateId)
    Parameters
    Type Name Description
    int masterTemplateId
    Returns
    Type Description
    IEnumerable<ITemplate>
    View Source

    GetTemplateFileContentStream(string)

    Gets the content of a template as a stream.

    Declaration
    [Obsolete("Please use ITemplateService for template operations. Scheduled for removal in Umbraco 18.")]
    Stream GetTemplateFileContentStream(string filepath)
    Parameters
    Type Name Description
    string filepath

    The filesystem path to the template.

    Returns
    Type Description
    Stream

    The content of the template.

    View Source

    GetTemplateFileSize(string)

    Gets the size of a template.

    Declaration
    [Obsolete("Please use ITemplateService for template operations. Scheduled for removal in Umbraco 18.")]
    long GetTemplateFileSize(string filepath)
    Parameters
    Type Name Description
    string filepath

    The filesystem path to the template.

    Returns
    Type Description
    long

    The size of the template.

    View Source

    GetTemplates(int)

    Gets a list of all ITemplate objects

    Declaration
    [Obsolete("Please use ITemplateService for template operations. Scheduled for removal in Umbraco 18.")]
    IEnumerable<ITemplate> GetTemplates(int masterTemplateId)
    Parameters
    Type Name Description
    int masterTemplateId
    Returns
    Type Description
    IEnumerable<ITemplate>

    An enumerable list of ITemplate objects

    View Source

    GetTemplates(params string[])

    Gets a list of all ITemplate objects

    Declaration
    [Obsolete("Please use ITemplateService for template operations. Scheduled for removal in Umbraco 18.")]
    IEnumerable<ITemplate> GetTemplates(params string[] aliases)
    Parameters
    Type Name Description
    string[] aliases
    Returns
    Type Description
    IEnumerable<ITemplate>

    An enumerable list of ITemplate objects

    View Source

    SavePartialView(IPartialView, int?)

    Saves a IPartialView.

    Declaration
    [Obsolete("Please use IPartialViewService for partial view operations. Scheduled for removal in Umbraco 18.")]
    Attempt<IPartialView?> SavePartialView(IPartialView partialView, int? userId = null)
    Parameters
    Type Name Description
    IPartialView partialView

    The IPartialView to save.

    int? userId

    Optional id of the user saving the partial view.

    Returns
    Type Description
    Attempt<IPartialView>

    An Attempt<TResult> indicating success or failure with the saved partial view.

    View Source

    SaveScript(IScript?, int?)

    Saves a Script

    Declaration
    [Obsolete("Please use IScriptService for script operations. Scheduled for removal in Umbraco 18.")]
    void SaveScript(IScript? script, int? userId = -1)
    Parameters
    Type Name Description
    IScript script

    IScript to save

    int? userId

    Optional id of the user saving the script

    View Source

    SaveStylesheet(IStylesheet?, int?)

    Saves a IStylesheet

    Declaration
    [Obsolete("Please use IStylesheetService for stylesheet operations. Scheduled for removal in Umbraco 18.")]
    void SaveStylesheet(IStylesheet? stylesheet, int? userId = null)
    Parameters
    Type Name Description
    IStylesheet stylesheet

    IStylesheet to save

    int? userId

    Optional id of the user saving the stylesheet

    View Source

    SaveTemplate(IEnumerable<ITemplate>, int)

    Saves a collection of Template objects

    Declaration
    [Obsolete("Please use ITemplateService for template operations. Scheduled for removal in Umbraco 18.")]
    void SaveTemplate(IEnumerable<ITemplate> templates, int userId = -1)
    Parameters
    Type Name Description
    IEnumerable<ITemplate> templates

    List of Template to save

    int userId

    Optional id of the user

    View Source

    SaveTemplate(ITemplate, int)

    Saves a ITemplate

    Declaration
    [Obsolete("Please use ITemplateService for template operations. Scheduled for removal in Umbraco 18.")]
    void SaveTemplate(ITemplate template, int userId = -1)
    Parameters
    Type Name Description
    ITemplate template

    ITemplate to save

    int userId

    Optional id of the user saving the template

    View Source

    SetPartialViewFileContent(string, Stream)

    Sets the content of a partial view.

    Declaration
    [Obsolete("Please use IPartialViewService for partial view operations. Scheduled for removal in Umbraco 18.")]
    void SetPartialViewFileContent(string filepath, Stream content)
    Parameters
    Type Name Description
    string filepath

    The filesystem path to the partial view.

    Stream content

    The content of the partial view.

    View Source

    SetScriptFileContent(string, Stream)

    Sets the content of a script file.

    Declaration
    [Obsolete("Please use IScriptService for script operations. Scheduled for removal in Umbraco 18.")]
    void SetScriptFileContent(string filepath, Stream content)
    Parameters
    Type Name Description
    string filepath

    The filesystem path to the script.

    Stream content

    The content of the script file.

    View Source

    SetStylesheetFileContent(string, Stream)

    Sets the content of a stylesheet.

    Declaration
    [Obsolete("Please use IStylesheetService for stylesheet operations. Scheduled for removal in Umbraco 18.")]
    void SetStylesheetFileContent(string filepath, Stream content)
    Parameters
    Type Name Description
    string filepath

    The filesystem path to the stylesheet.

    Stream content

    The content of the stylesheet.

    View Source

    SetTemplateFileContent(string, Stream)

    Sets the content of a template.

    Declaration
    [Obsolete("Please use ITemplateService for template operations. Scheduled for removal in Umbraco 18.")]
    void SetTemplateFileContent(string filepath, Stream content)
    Parameters
    Type Name Description
    string filepath

    The filesystem path to the template.

    Stream content

    The content of the template.

    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX