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 SourceCreatePartialView(IPartialView, string?, int?)
Declaration
[Obsolete("Please use IPartialViewService for partial view operations - will be removed in Umbraco 15")]
Attempt<IPartialView?> CreatePartialView(IPartialView partialView, string? snippetName = null, int? userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IPartialView | partialView | |
| string | snippetName | |
| int? | userId |
Returns
| Type | Description |
|---|---|
| Attempt<IPartialView> |
CreatePartialViewFolder(string)
Declaration
[Obsolete("Please use IPartialViewFolderService for partial view folder operations - will be removed in Umbraco 15")]
void CreatePartialViewFolder(string folderPath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | folderPath |
CreateScriptFolder(string)
Creates a folder for scripts
Declaration
[Obsolete("Please use IScriptFolderService for script folder operations - will be removed in Umbraco 15")]
void CreateScriptFolder(string folderPath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | folderPath |
CreateStyleSheetFolder(string)
Creates a folder for style sheets
Declaration
[Obsolete("Please use IStylesheetFolderService for stylesheet folder operations - will be removed in Umbraco 15")]
void CreateStyleSheetFolder(string folderPath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | folderPath |
CreateTemplateForContentType(string, string?, int)
Creates a template for a content type
Declaration
[Obsolete("Please use ITemplateService for template operations - will be removed in Umbraco 15")]
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 |
CreateTemplateWithIdentity(string?, string?, string?, ITemplate?, int)
Declaration
[Obsolete("Please use ITemplateService for template operations - will be removed in Umbraco 15")]
ITemplate CreateTemplateWithIdentity(string? name, string? alias, string? content, ITemplate? masterTemplate = null, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| string | alias | |
| string | content | |
| ITemplate | masterTemplate | |
| int | userId |
Returns
| Type | Description |
|---|---|
| ITemplate |
DeletePartialView(string, int?)
Declaration
[Obsolete("Please use IPartialViewService for partial view operations - will be removed in Umbraco 15")]
bool DeletePartialView(string path, int? userId = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path | |
| int? | userId |
Returns
| Type | Description |
|---|---|
| bool |
DeletePartialViewFolder(string)
Declaration
[Obsolete("Please use IPartialViewFolderService for partial view folder operations - will be removed in Umbraco 15")]
void DeletePartialViewFolder(string folderPath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | folderPath |
DeleteScript(string, int?)
Deletes a script by its name
Declaration
[Obsolete("Please use IScriptService for script operations - will be removed in Umbraco 15")]
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 |
DeleteScriptFolder(string)
Deletes a folder for scripts
Declaration
[Obsolete("Please use IScriptFolderService for script folder operations - will be removed in Umbraco 15")]
void DeleteScriptFolder(string folderPath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | folderPath |
DeleteStyleSheetFolder(string)
Deletes a folder for style sheets
Declaration
[Obsolete("Please use IStylesheetFolderService for stylesheet folder operations - will be removed in Umbraco 15")]
void DeleteStyleSheetFolder(string folderPath)
Parameters
| Type | Name | Description |
|---|---|---|
| string | folderPath |
DeleteStylesheet(string, int?)
Deletes a stylesheet by its name
Declaration
[Obsolete("Please use IStylesheetService for stylesheet operations - will be removed in Umbraco 15")]
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 |
DeleteTemplate(string, int)
Deletes a template by its alias
Declaration
[Obsolete("Please use ITemplateService for template operations - will be removed in Umbraco 15")]
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 |
GetPartialView(string)
Declaration
[Obsolete("Please use IPartialViewService for partial view operations - will be removed in Umbraco 15")]
IPartialView? GetPartialView(string path)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path |
Returns
| Type | Description |
|---|---|
| IPartialView |
GetPartialViewFileContentStream(string)
Gets the content of a partial view as a stream.
Declaration
[Obsolete("Please use IPartialViewService for partial view operations - will be removed in Umbraco 15")]
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. |
GetPartialViewFileSize(string)
Gets the size of a partial view.
Declaration
[Obsolete("Please use IPartialViewService for partial view operations - will be removed in Umbraco 15")]
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. |
GetPartialViews(params string[])
Gets a list of all IPartialView objects
Declaration
[Obsolete("Please use IPartialViewService for partial view operations - will be removed in Umbraco 15")]
IEnumerable<IPartialView> GetPartialViews(params string[] names)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | names |
Returns
| Type | Description |
|---|---|
| IEnumerable<IPartialView> | An enumerable list of IPartialView objects |
GetScript(string?)
Gets a IScript object by its name
Declaration
[Obsolete("Please use IScriptService for script operations - will be removed in Umbraco 15")]
IScript? GetScript(string? name)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | Name of the script incl. extension |
Returns
| Type | Description |
|---|---|
| IScript | A IScript object |
GetScriptFileContentStream(string)
Gets the content of a script file as a stream.
Declaration
[Obsolete("Please use IScriptService for script operations - will be removed in Umbraco 15")]
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. |
GetScriptFileSize(string)
Gets the size of a script file.
Declaration
[Obsolete("Please use IScriptService for script operations - will be removed in Umbraco 15")]
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. |
GetScripts(params string[])
Gets a list of all IScript objects
Declaration
[Obsolete("Please use IScriptService for script operations - will be removed in Umbraco 15")]
IEnumerable<IScript> GetScripts(params string[] names)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | names |
Returns
| Type | Description |
|---|---|
| IEnumerable<IScript> | An enumerable list of IScript objects |
GetStylesheet(string?)
Gets a IStylesheet object by its name
Declaration
[Obsolete("Please use IStylesheetService for stylesheet operations - will be removed in Umbraco 15")]
IStylesheet? GetStylesheet(string? path)
Parameters
| Type | Name | Description |
|---|---|---|
| string | path | Path of the stylesheet incl. extension |
Returns
| Type | Description |
|---|---|
| IStylesheet | A IStylesheet object |
GetStylesheetFileContentStream(string)
Gets the content of a stylesheet as a stream.
Declaration
[Obsolete("Please use IStylesheetService for stylesheet operations - will be removed in Umbraco 15")]
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. |
GetStylesheetFileSize(string)
Gets the size of a stylesheet.
Declaration
[Obsolete("Please use IStylesheetService for stylesheet operations - will be removed in Umbraco 15")]
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. |
GetStylesheets(params string[])
Gets a list of all IStylesheet objects
Declaration
[Obsolete("Please use IStylesheetService for stylesheet operations - will be removed in Umbraco 15")]
IEnumerable<IStylesheet> GetStylesheets(params string[] paths)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | paths |
Returns
| Type | Description |
|---|---|
| IEnumerable<IStylesheet> | An enumerable list of IStylesheet objects |
GetTemplate(Guid)
Gets a ITemplate object by its guid identifier.
Declaration
[Obsolete("Please use ITemplateService for template operations - will be removed in Umbraco 15")]
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. |
GetTemplate(int)
Gets a ITemplate object by its identifier.
Declaration
[Obsolete("Please use ITemplateService for template operations - will be removed in Umbraco 15")]
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. |
GetTemplate(string?)
Gets a ITemplate object by its alias.
Declaration
[Obsolete("Please use ITemplateService for template operations - will be removed in Umbraco 15")]
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. |
GetTemplateDescendants(int)
Gets the template descendants
Declaration
[Obsolete("Please use ITemplateService for template operations - will be removed in Umbraco 15")]
IEnumerable<ITemplate> GetTemplateDescendants(int masterTemplateId)
Parameters
| Type | Name | Description |
|---|---|---|
| int | masterTemplateId |
Returns
| Type | Description |
|---|---|
| IEnumerable<ITemplate> |
GetTemplateFileContentStream(string)
Gets the content of a template as a stream.
Declaration
[Obsolete("Please use ITemplateService for template operations - will be removed in Umbraco 15")]
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. |
GetTemplateFileSize(string)
Gets the size of a template.
Declaration
[Obsolete("Please use ITemplateService for template operations - will be removed in Umbraco 15")]
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. |
GetTemplates(int)
Gets a list of all ITemplate objects
Declaration
[Obsolete("Please use ITemplateService for template operations - will be removed in Umbraco 15")]
IEnumerable<ITemplate> GetTemplates(int masterTemplateId)
Parameters
| Type | Name | Description |
|---|---|---|
| int | masterTemplateId |
Returns
| Type | Description |
|---|---|
| IEnumerable<ITemplate> | An enumerable list of ITemplate objects |
GetTemplates(params string[])
Gets a list of all ITemplate objects
Declaration
[Obsolete("Please use ITemplateService for template operations - will be removed in Umbraco 15")]
IEnumerable<ITemplate> GetTemplates(params string[] aliases)
Parameters
| Type | Name | Description |
|---|---|---|
| string[] | aliases |
Returns
| Type | Description |
|---|---|
| IEnumerable<ITemplate> | An enumerable list of ITemplate objects |
SavePartialView(IPartialView, int?)
Declaration
[Obsolete("Please use IPartialViewService for partial view operations - will be removed in Umbraco 15")]
Attempt<IPartialView?> SavePartialView(IPartialView partialView, int? userId = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPartialView | partialView | |
| int? | userId |
Returns
| Type | Description |
|---|---|
| Attempt<IPartialView> |
SaveScript(IScript?, int?)
Saves a Script
Declaration
[Obsolete("Please use IScriptService for script operations - will be removed in Umbraco 15")]
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 |
SaveStylesheet(IStylesheet?, int?)
Saves a IStylesheet
Declaration
[Obsolete("Please use IStylesheetService for stylesheet operations - will be removed in Umbraco 15")]
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 |
SaveTemplate(IEnumerable<ITemplate>, int)
Saves a collection of Template objects
Declaration
[Obsolete("Please use ITemplateService for template operations - will be removed in Umbraco 15")]
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 |
SaveTemplate(ITemplate, int)
Saves a ITemplate
Declaration
[Obsolete("Please use ITemplateService for template operations - will be removed in Umbraco 15")]
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 |
SetPartialViewFileContent(string, Stream)
Sets the content of a partial view.
Declaration
[Obsolete("Please use IPartialViewService for partial view operations - will be removed in Umbraco 15")]
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. |
SetScriptFileContent(string, Stream)
Sets the content of a script file.
Declaration
[Obsolete("Please use IScriptService for script operations - will be removed in Umbraco 15")]
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. |
SetStylesheetFileContent(string, Stream)
Sets the content of a stylesheet.
Declaration
[Obsolete("Please use IStylesheetService for stylesheet operations - will be removed in Umbraco 15")]
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. |
SetTemplateFileContent(string, Stream)
Sets the content of a template.
Declaration
[Obsolete("Please use ITemplateService for template operations - will be removed in Umbraco 15")]
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. |