Search Results for

    Show / Hide Table of Contents
    View Source

    Class ContentServiceExtensions

    Content service extension methods

    Inheritance
    object
    Namespace: Umbraco.Extensions
    Assembly: Umbraco.Core.dll
    Syntax
    public static class ContentServiceExtensions

    Methods

    View Source

    CreateContent(IContentService, string, Udi, string, int)

    Method to create an IContent object based on the Udi of a parent

    Declaration
    public static IContent CreateContent(this IContentService contentService, string name, Udi parentId, string contentTypeAlias, int userId = -1)
    Parameters
    Type Name Description
    IContentService contentService
    string name
    Udi parentId
    string contentTypeAlias
    int userId
    Returns
    Type Description
    IContent
    View Source

    GetAnchorValuesFromRTEContent(IContentService, string)

    Extracts anchor values from Rich Text Editor content.

    Declaration
    public static IEnumerable<string> GetAnchorValuesFromRTEContent(this IContentService contentService, string rteContent)
    Parameters
    Type Name Description
    IContentService contentService

    The content service.

    string rteContent

    The RTE content to extract anchors from.

    Returns
    Type Description
    IEnumerable<string>

    A collection of anchor values found in the content.

    View Source

    GetAnchorValuesFromRTEs(IContentService, int, string?)

    Gets all anchor values from Rich Text Editor properties of a content item.

    Declaration
    public static IEnumerable<string> GetAnchorValuesFromRTEs(this IContentService contentService, int id, string? culture = "*")
    Parameters
    Type Name Description
    IContentService contentService

    The content service.

    int id

    The content item identifier.

    string culture

    The culture to use, or "" for all cultures. Defaults to "".

    Returns
    Type Description
    IEnumerable<string>

    A collection of anchor values found in the RTE properties.

    View Source

    GetByIds(IContentService, IEnumerable<Udi>)

    Gets content items by their UDI identifiers.

    Declaration
    public static IEnumerable<IContent> GetByIds(this IContentService contentService, IEnumerable<Udi> ids)
    Parameters
    Type Name Description
    IContentService contentService

    The content service.

    IEnumerable<Udi> ids

    The UDI identifiers of the content items to retrieve.

    Returns
    Type Description
    IEnumerable<IContent>

    A collection of content items matching the specified UDIs.

    Exceptions
    Type Condition
    InvalidOperationException

    Thrown when any UDI is not a GuidUdi.

    View Source

    RemoveContentPermissions(IContentService, int)

    Remove all permissions for this user for all nodes

    Declaration
    public static void RemoveContentPermissions(this IContentService contentService, int contentId)
    Parameters
    Type Name Description
    IContentService contentService
    int contentId
    • View Source
    In this article
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX