Search Results for

    Show / Hide Table of Contents
    View Source

    Class ContentService

    Implements the content service.

    Inheritance
    System.Object
    RepositoryService
    Namespace: Umbraco.Core.Services.Implement
    Assembly: Umbraco.Core.dll
    Syntax
    public class ContentService : RepositoryService, IContentService, IContentServiceBase, IService, IContentVersionService

    Constructors

    View Source

    ContentService(IScopeProvider, ILogger, IEventMessagesFactory, IDocumentRepository, IEntityRepository, IAuditRepository, IContentTypeRepository, IDocumentBlueprintRepository, ILanguageRepository)

    Declaration
    public ContentService(IScopeProvider provider, ILogger logger, IEventMessagesFactory eventMessagesFactory, IDocumentRepository documentRepository, IEntityRepository entityRepository, IAuditRepository auditRepository, IContentTypeRepository contentTypeRepository, IDocumentBlueprintRepository documentBlueprintRepository, ILanguageRepository languageRepository)
    Parameters
    Type Name Description
    IScopeProvider provider
    ILogger logger
    IEventMessagesFactory eventMessagesFactory
    IDocumentRepository documentRepository
    IEntityRepository entityRepository
    IAuditRepository auditRepository
    IContentTypeRepository contentTypeRepository
    IDocumentBlueprintRepository documentBlueprintRepository
    ILanguageRepository languageRepository

    Methods

    View Source

    CheckDataIntegrity(ContentDataIntegrityReportOptions)

    Declaration
    public ContentDataIntegrityReport CheckDataIntegrity(ContentDataIntegrityReportOptions options)
    Parameters
    Type Name Description
    ContentDataIntegrityReportOptions options
    Returns
    Type Description
    ContentDataIntegrityReport
    View Source

    Copy(IContent, Int32, Boolean, Boolean, Int32)

    Copies an IContent object by creating a new Content object of the same type and copies all data from the current to the new copy which is returned.

    Declaration
    public IContent Copy(IContent content, int parentId, bool relateToOriginal, bool recursive, int userId = -1)
    Parameters
    Type Name Description
    IContent content

    The IContent to copy

    System.Int32 parentId

    Id of the Content's new Parent

    System.Boolean relateToOriginal

    Boolean indicating whether the copy should be related to the original

    System.Boolean recursive

    A value indicating whether to recursively copy children.

    System.Int32 userId

    Optional Id of the User copying the Content

    Returns
    Type Description
    IContent

    The newly created IContent object

    View Source

    Copy(IContent, Int32, Boolean, Int32)

    Copies an IContent object by creating a new Content object of the same type and copies all data from the current to the new copy which is returned. Recursively copies all children.

    Declaration
    public IContent Copy(IContent content, int parentId, bool relateToOriginal, int userId = -1)
    Parameters
    Type Name Description
    IContent content

    The IContent to copy

    System.Int32 parentId

    Id of the Content's new Parent

    System.Boolean relateToOriginal

    Boolean indicating whether the copy should be related to the original

    System.Int32 userId

    Optional Id of the User copying the Content

    Returns
    Type Description
    IContent

    The newly created IContent object

    View Source

    Count(String)

    Declaration
    public int Count(string contentTypeAlias = null)
    Parameters
    Type Name Description
    System.String contentTypeAlias
    Returns
    Type Description
    System.Int32
    View Source

    CountChildren(Int32, String)

    Declaration
    public int CountChildren(int parentId, string contentTypeAlias = null)
    Parameters
    Type Name Description
    System.Int32 parentId
    System.String contentTypeAlias
    Returns
    Type Description
    System.Int32
    View Source

    CountDescendants(Int32, String)

    Declaration
    public int CountDescendants(int parentId, string contentTypeAlias = null)
    Parameters
    Type Name Description
    System.Int32 parentId
    System.String contentTypeAlias
    Returns
    Type Description
    System.Int32
    View Source

    CountPublished(String)

    Declaration
    public int CountPublished(string contentTypeAlias = null)
    Parameters
    Type Name Description
    System.String contentTypeAlias
    Returns
    Type Description
    System.Int32
    View Source

    Create(String, Guid, String, Int32)

    Creates an IContent object using the alias of the IContentType that this Content should based on.

    Declaration
    public IContent Create(string name, Guid parentId, string contentTypeAlias, int userId = -1)
    Parameters
    Type Name Description
    System.String name

    Name of the Content object

    System.Guid parentId

    Id of Parent for the new Content

    System.String contentTypeAlias

    Alias of the IContentType

    System.Int32 userId

    Optional id of the user creating the content

    Returns
    Type Description
    IContent IContent
    Remarks

    Note that using this method will simply return a new IContent without any identity as it has not yet been persisted. It is intended as a shortcut to creating new content objects that does not invoke a save operation against the database.

    View Source

    Create(String, Int32, String, Int32)

    Creates an IContent object of a specified content type.

    Declaration
    public IContent Create(string name, int parentId, string contentTypeAlias, int userId = -1)
    Parameters
    Type Name Description
    System.String name

    The name of the content object.

    System.Int32 parentId

    The identifier of the parent, or -1.

    System.String contentTypeAlias

    The alias of the content type.

    System.Int32 userId

    The optional id of the user creating the content.

    Returns
    Type Description
    IContent

    The content object.

    Remarks

    This method simply returns a new, non-persisted, IContent without any identity. It is intended as a shortcut to creating new content objects that does not invoke a save operation against the database.

    View Source

    Create(String, Int32, IContentType, Int32)

    Creates an IContent object of a specified content type.

    Declaration
    public IContent Create(string name, int parentId, IContentType contentType, int userId = -1)
    Parameters
    Type Name Description
    System.String name

    The name of the content object.

    System.Int32 parentId

    The identifier of the parent, or -1.

    IContentType contentType

    The content type of the content

    System.Int32 userId

    The optional id of the user creating the content.

    Returns
    Type Description
    IContent

    The content object.

    Remarks

    This method simply returns a new, non-persisted, IContent without any identity. It is intended as a shortcut to creating new content objects that does not invoke a save operation against the database.

    View Source

    Create(String, IContent, String, Int32)

    Creates an IContent object of a specified content type, under a parent.

    Declaration
    public IContent Create(string name, IContent parent, string contentTypeAlias, int userId = -1)
    Parameters
    Type Name Description
    System.String name

    The name of the content object.

    IContent parent

    The parent content object.

    System.String contentTypeAlias

    The alias of the content type.

    System.Int32 userId

    The optional id of the user creating the content.

    Returns
    Type Description
    IContent

    The content object.

    Remarks

    This method simply returns a new, non-persisted, IContent without any identity. It is intended as a shortcut to creating new content objects that does not invoke a save operation against the database.

    View Source

    CreateAndSave(String, Int32, String, Int32)

    Creates an IContent object of a specified content type.

    Declaration
    public IContent CreateAndSave(string name, int parentId, string contentTypeAlias, int userId = -1)
    Parameters
    Type Name Description
    System.String name

    The name of the content object.

    System.Int32 parentId

    The identifier of the parent, or -1.

    System.String contentTypeAlias

    The alias of the content type.

    System.Int32 userId

    The optional id of the user creating the content.

    Returns
    Type Description
    IContent

    The content object.

    Remarks

    This method returns a new, persisted, IContent with an identity.

    View Source

    CreateAndSave(String, IContent, String, Int32)

    Creates an IContent object of a specified content type, under a parent.

    Declaration
    public IContent CreateAndSave(string name, IContent parent, string contentTypeAlias, int userId = -1)
    Parameters
    Type Name Description
    System.String name

    The name of the content object.

    IContent parent

    The parent content object.

    System.String contentTypeAlias

    The alias of the content type.

    System.Int32 userId

    The optional id of the user creating the content.

    Returns
    Type Description
    IContent

    The content object.

    Remarks

    This method returns a new, persisted, IContent with an identity.

    View Source

    CreateContentFromBlueprint(IContent, String, Int32)

    Declaration
    public IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = -1)
    Parameters
    Type Name Description
    IContent blueprint
    System.String name
    System.Int32 userId
    Returns
    Type Description
    IContent
    View Source

    Delete(IContent, Int32)

    Deletes a document.

    Declaration
    public OperationResult Delete(IContent content, int userId)
    Parameters
    Type Name Description
    IContent content
    System.Int32 userId
    Returns
    Type Description
    OperationResult
    Remarks

    This method will also delete associated media files, child content and possibly associated domains.

    This method entirely clears the content from the database.

    View Source

    DeleteBlueprint(IContent, Int32)

    Declaration
    public void DeleteBlueprint(IContent content, int userId = -1)
    Parameters
    Type Name Description
    IContent content
    System.Int32 userId
    View Source

    DeleteBlueprintsOfType(Int32, Int32)

    Declaration
    public void DeleteBlueprintsOfType(int contentTypeId, int userId = -1)
    Parameters
    Type Name Description
    System.Int32 contentTypeId
    System.Int32 userId
    View Source

    DeleteBlueprintsOfTypes(IEnumerable<Int32>, Int32)

    Declaration
    public void DeleteBlueprintsOfTypes(IEnumerable<int> contentTypeIds, int userId = -1)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.Int32> contentTypeIds
    System.Int32 userId
    View Source

    DeleteOfType(Int32, Int32)

    Deletes all content items of specified type. All children of deleted content item is moved to Recycle Bin.

    Declaration
    public void DeleteOfType(int contentTypeId, int userId = -1)
    Parameters
    Type Name Description
    System.Int32 contentTypeId

    Id of the IContentType

    System.Int32 userId

    Optional id of the user deleting the media

    Remarks

    This needs extra care and attention as its potentially a dangerous and extensive operation

    View Source

    DeleteOfTypes(IEnumerable<Int32>, Int32)

    Deletes all content of specified type. All children of deleted content is moved to Recycle Bin.

    Declaration
    public void DeleteOfTypes(IEnumerable<int> contentTypeIds, int userId = -1)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.Int32> contentTypeIds

    Id of the IContentType

    System.Int32 userId

    Optional Id of the user issuing the delete operation

    Remarks

    This needs extra care and attention as its potentially a dangerous and extensive operation.

    Deletes content items of the specified type, and only that type. Does not handle content types inheritance and compositions, which need to be managed outside of this method.

    View Source

    DeleteVersion(Int32, Int32, Boolean, Int32)

    Permanently deletes specific version(s) from an IContent object. This method will never delete the latest version of a content item.

    Declaration
    public void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = -1)
    Parameters
    Type Name Description
    System.Int32 id

    Id of the IContent object to delete a version from

    System.Int32 versionId

    Id of the version to delete

    System.Boolean deletePriorVersions

    Boolean indicating whether to delete versions prior to the versionId

    System.Int32 userId

    Optional Id of the User deleting versions of a Content object

    View Source

    DeleteVersions(Int32, DateTime, Int32)

    Permanently deletes versions from an IContent object prior to a specific date. This method will never delete the latest version of a content item.

    Declaration
    public void DeleteVersions(int id, DateTime versionDate, int userId = -1)
    Parameters
    Type Name Description
    System.Int32 id

    Id of the IContent object to delete versions from

    System.DateTime versionDate

    Latest version date

    System.Int32 userId

    Optional Id of the User deleting versions of a Content object

    View Source

    EmptyRecycleBin()

    Empties the Recycle Bin by deleting all IContent that resides in the bin

    Declaration
    [Obsolete("Use EmptyRecycleBin with explicit indication of user ID instead")]
    public OperationResult EmptyRecycleBin()
    Returns
    Type Description
    OperationResult
    View Source

    EmptyRecycleBin(Int32)

    Empties the Recycle Bin by deleting all IContent that resides in the bin

    Declaration
    public OperationResult EmptyRecycleBin(int userId = -1)
    Parameters
    Type Name Description
    System.Int32 userId
    Returns
    Type Description
    OperationResult
    View Source

    GetAncestors(Int32)

    Gets a collection of IContent objects, which are ancestors of the current content.

    Declaration
    public IEnumerable<IContent> GetAncestors(int id)
    Parameters
    Type Name Description
    System.Int32 id

    Id of the IContent to retrieve ancestors for

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IContent>

    An Enumerable list of IContent objects

    View Source

    GetAncestors(IContent)

    Gets a collection of IContent objects, which are ancestors of the current content.

    Declaration
    public IEnumerable<IContent> GetAncestors(IContent content)
    Parameters
    Type Name Description
    IContent content

    IContent to retrieve ancestors for

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IContent>

    An Enumerable list of IContent objects

    View Source

    GetBlueprintById(Guid)

    Declaration
    public IContent GetBlueprintById(Guid id)
    Parameters
    Type Name Description
    System.Guid id
    Returns
    Type Description
    IContent
    View Source

    GetBlueprintById(Int32)

    Declaration
    public IContent GetBlueprintById(int id)
    Parameters
    Type Name Description
    System.Int32 id
    Returns
    Type Description
    IContent
    View Source

    GetBlueprintsForContentTypes(Int32[])

    Declaration
    public IEnumerable<IContent> GetBlueprintsForContentTypes(params int[] contentTypeId)
    Parameters
    Type Name Description
    System.Int32[] contentTypeId
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IContent>
    View Source

    GetById(Guid)

    Gets an IContent object by its 'UniqueId'

    Declaration
    public IContent GetById(Guid key)
    Parameters
    Type Name Description
    System.Guid key

    Guid key of the Content to retrieve

    Returns
    Type Description
    IContent IContent
    View Source

    GetById(Int32)

    Gets an IContent object by Id

    Declaration
    public IContent GetById(int id)
    Parameters
    Type Name Description
    System.Int32 id

    Id of the Content to retrieve

    Returns
    Type Description
    IContent IContent
    View Source

    GetByIds(IEnumerable<Guid>)

    Gets IContent objects by Ids

    Declaration
    public IEnumerable<IContent> GetByIds(IEnumerable<Guid> ids)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.Guid> ids

    Ids of the Content to retrieve

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IContent> IContent
    View Source

    GetByIds(IEnumerable<Int32>)

    Gets an IContent object by Id

    Declaration
    public IEnumerable<IContent> GetByIds(IEnumerable<int> ids)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.Int32> ids

    Ids of the Content to retrieve

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IContent> IContent
    View Source

    GetByLevel(Int32)

    Gets a collection of IContent objects by Level

    Declaration
    public IEnumerable<IContent> GetByLevel(int level)
    Parameters
    Type Name Description
    System.Int32 level

    The level to retrieve Content from

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IContent>

    An Enumerable list of IContent objects

    Remarks

    Contrary to most methods, this method filters out trashed content items.

    View Source

    GetContentForExpiration(DateTime)

    Gets documents having an expiration date before (lower than, or equal to) a specified date.

    Declaration
    public IEnumerable<IContent> GetContentForExpiration(DateTime date)
    Parameters
    Type Name Description
    System.DateTime date
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IContent>

    An Enumerable list of IContent objects

    Remarks

    The content returned from this method may be culture variant, in which case the resulting ContentSchedule should be queried for which culture(s) have been scheduled.

    View Source

    GetContentForRelease(DateTime)

    Gets documents having a release date before (lower than, or equal to) a specified date.

    Declaration
    public IEnumerable<IContent> GetContentForRelease(DateTime date)
    Parameters
    Type Name Description
    System.DateTime date
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IContent>

    An Enumerable list of IContent objects

    Remarks

    The content returned from this method may be culture variant, in which case the resulting ContentSchedule should be queried for which culture(s) have been scheduled.

    View Source

    GetPagedChildren(Int32, Int64, Int32, out Int64, IQuery<IContent>, Ordering)

    Gets child documents of a parent.

    Declaration
    public IEnumerable<IContent> GetPagedChildren(int id, long pageIndex, int pageSize, out long totalChildren, IQuery<IContent> filter = null, Ordering ordering = null)
    Parameters
    Type Name Description
    System.Int32 id

    The parent identifier.

    System.Int64 pageIndex

    The page number.

    System.Int32 pageSize

    The page size.

    System.Int64 totalChildren
    IQuery<IContent> filter

    Query filter.

    Ordering ordering

    Ordering infos.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IContent>
    View Source

    GetPagedContentInRecycleBin(Int64, Int32, out Int64, IQuery<IContent>, Ordering)

    Gets a collection of an IContent objects, which resides in the Recycle Bin

    Declaration
    public IEnumerable<IContent> GetPagedContentInRecycleBin(long pageIndex, int pageSize, out long totalRecords, IQuery<IContent> filter = null, Ordering ordering = null)
    Parameters
    Type Name Description
    System.Int64 pageIndex
    System.Int32 pageSize
    System.Int64 totalRecords
    IQuery<IContent> filter
    Ordering ordering
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IContent>

    An Enumerable list of IContent objects

    View Source

    GetPagedContentVersions(Int32, Int64, Int32, out Int64, String)

    Gets paginated content versions for given content id paginated.

    Declaration
    public IEnumerable<ContentVersionMeta> GetPagedContentVersions(int contentId, long pageIndex, int pageSize, out long totalRecords, string culture = null)
    Parameters
    Type Name Description
    System.Int32 contentId
    System.Int64 pageIndex
    System.Int32 pageSize
    System.Int64 totalRecords
    System.String culture
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<ContentVersionMeta>
    Exceptions
    Type Condition
    System.ArgumentException

    Thrown when culture is invalid.

    View Source

    GetPagedDescendants(Int32, Int64, Int32, out Int64, IQuery<IContent>, Ordering)

    Gets descendant documents of a given parent.

    Declaration
    public IEnumerable<IContent> GetPagedDescendants(int id, long pageIndex, int pageSize, out long totalChildren, IQuery<IContent> filter = null, Ordering ordering = null)
    Parameters
    Type Name Description
    System.Int32 id

    The parent identifier.

    System.Int64 pageIndex

    The page number.

    System.Int32 pageSize

    The page size.

    System.Int64 totalChildren
    IQuery<IContent> filter

    Query filter.

    Ordering ordering

    Ordering infos.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IContent>
    View Source

    GetPagedOfType(Int32, Int64, Int32, out Int64, IQuery<IContent>, Ordering)

    Gets paged documents of a content

    Declaration
    public IEnumerable<IContent> GetPagedOfType(int contentTypeId, long pageIndex, int pageSize, out long totalRecords, IQuery<IContent> filter = null, Ordering ordering = null)
    Parameters
    Type Name Description
    System.Int32 contentTypeId

    The page number.

    System.Int64 pageIndex

    The page number.

    System.Int32 pageSize

    The page size.

    System.Int64 totalRecords

    Total number of documents.

    IQuery<IContent> filter

    Search text filter.

    Ordering ordering

    Ordering infos.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IContent>
    View Source

    GetPagedOfTypes(Int32[], Int64, Int32, out Int64, IQuery<IContent>, Ordering)

    Gets paged documents for specified content types

    Declaration
    public IEnumerable<IContent> GetPagedOfTypes(int[] contentTypeIds, long pageIndex, int pageSize, out long totalRecords, IQuery<IContent> filter, Ordering ordering = null)
    Parameters
    Type Name Description
    System.Int32[] contentTypeIds

    The page number.

    System.Int64 pageIndex

    The page number.

    System.Int32 pageSize

    The page size.

    System.Int64 totalRecords

    Total number of documents.

    IQuery<IContent> filter

    Search text filter.

    Ordering ordering

    Ordering infos.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IContent>
    View Source

    GetParent(Int32)

    Gets the parent of the current content as an IContent item.

    Declaration
    public IContent GetParent(int id)
    Parameters
    Type Name Description
    System.Int32 id

    Id of the IContent to retrieve the parent from

    Returns
    Type Description
    IContent

    Parent IContent object

    View Source

    GetParent(IContent)

    Gets the parent of the current content as an IContent item.

    Declaration
    public IContent GetParent(IContent content)
    Parameters
    Type Name Description
    IContent content

    IContent to retrieve the parent from

    Returns
    Type Description
    IContent

    Parent IContent object

    View Source

    GetPermissions(IContent)

    Returns implicit/inherited permissions assigned to the content item for all user groups

    Declaration
    public EntityPermissionCollection GetPermissions(IContent content)
    Parameters
    Type Name Description
    IContent content
    Returns
    Type Description
    EntityPermissionCollection
    View Source

    GetPublishedChildren(Int32)

    Gets a collection of published IContent objects by Parent Id

    Declaration
    public IEnumerable<IContent> GetPublishedChildren(int id)
    Parameters
    Type Name Description
    System.Int32 id

    Id of the Parent to retrieve Children from

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IContent>

    An Enumerable list of published IContent objects

    View Source

    GetRootContent()

    Gets a collection of IContent objects, which reside at the first level / root

    Declaration
    public IEnumerable<IContent> GetRootContent()
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IContent>

    An Enumerable list of IContent objects

    View Source

    GetVersion(Int32)

    Gets a specific version of an IContent item.

    Declaration
    public IContent GetVersion(int versionId)
    Parameters
    Type Name Description
    System.Int32 versionId

    Id of the version to retrieve

    Returns
    Type Description
    IContent

    An IContent item

    View Source

    GetVersionIds(Int32, Int32)

    Gets a list of all version Ids for the given content item ordered so latest is first

    Declaration
    public IEnumerable<int> GetVersionIds(int id, int maxRows)
    Parameters
    Type Name Description
    System.Int32 id
    System.Int32 maxRows

    The maximum number of rows to return

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<System.Int32>
    View Source

    GetVersions(Int32)

    Gets a collection of an IContent objects versions by Id

    Declaration
    public IEnumerable<IContent> GetVersions(int id)
    Parameters
    Type Name Description
    System.Int32 id
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IContent>

    An Enumerable list of IContent objects

    View Source

    GetVersionsSlim(Int32, Int32, Int32)

    Gets a collection of an IContent objects versions by Id

    Declaration
    public IEnumerable<IContent> GetVersionsSlim(int id, int skip, int take)
    Parameters
    Type Name Description
    System.Int32 id
    System.Int32 skip
    System.Int32 take
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<IContent>

    An Enumerable list of IContent objects

    View Source

    HasChildren(Int32)

    Checks whether an IContent item has any children

    Declaration
    public bool HasChildren(int id)
    Parameters
    Type Name Description
    System.Int32 id

    Id of the IContent

    Returns
    Type Description
    System.Boolean

    True if the content has any children otherwise False

    View Source

    IsPathPublishable(IContent)

    Checks if the passed in IContent can be published based on the ancestors publish state.

    Declaration
    public bool IsPathPublishable(IContent content)
    Parameters
    Type Name Description
    IContent content

    IContent to check if ancestors are published

    Returns
    Type Description
    System.Boolean

    True if the Content can be published, otherwise False

    View Source

    IsPathPublished(IContent)

    Declaration
    public bool IsPathPublished(IContent content)
    Parameters
    Type Name Description
    IContent content
    Returns
    Type Description
    System.Boolean
    View Source

    Move(IContent, Int32, Int32)

    Moves an IContent object to a new location by changing its parent id.

    Declaration
    public void Move(IContent content, int parentId, int userId = -1)
    Parameters
    Type Name Description
    IContent content

    The IContent to move

    System.Int32 parentId

    Id of the Content's new Parent

    System.Int32 userId

    Optional Id of the User moving the Content

    Remarks

    If the IContent object is already published it will be published after being moved to its new location. Otherwise it'll just be saved with a new parent id.

    View Source

    MoveToRecycleBin(IContent, Int32)

    Moves a document to the recycle bin.

    Declaration
    public OperationResult MoveToRecycleBin(IContent content, int userId)
    Parameters
    Type Name Description
    IContent content
    System.Int32 userId
    Returns
    Type Description
    OperationResult
    View Source

    PerformContentVersionCleanup(DateTime)

    Removes historic content versions according to a policy.

    Declaration
    public IReadOnlyCollection<ContentVersionMeta> PerformContentVersionCleanup(DateTime asAtDate)
    Parameters
    Type Name Description
    System.DateTime asAtDate
    Returns
    Type Description
    System.Collections.Generic.IReadOnlyCollection<ContentVersionMeta>
    Remarks

    In v9 this can live in another class as we publish the notifications via IEventAggregator. But for v8 must be here for access to the static events.

    View Source

    PerformScheduledPublish(DateTime)

    Publishes and unpublishes scheduled documents.

    Declaration
    public IEnumerable<PublishResult> PerformScheduledPublish(DateTime date)
    Parameters
    Type Name Description
    System.DateTime date
    Returns
    Type Description
    System.Collections.Generic.IEnumerable<PublishResult>
    View Source

    RecycleBinSmells()

    Declaration
    public bool RecycleBinSmells()
    Returns
    Type Description
    System.Boolean
    View Source

    Rollback(Int32, Int32, String, Int32)

    Declaration
    public OperationResult Rollback(int id, int versionId, string culture = "*", int userId = -1)
    Parameters
    Type Name Description
    System.Int32 id
    System.Int32 versionId
    System.String culture
    System.Int32 userId
    Returns
    Type Description
    OperationResult
    View Source

    Save(IEnumerable<IContent>, Int32, Boolean)

    Saves documents.

    Declaration
    public OperationResult Save(IEnumerable<IContent> contents, int userId = -1, bool raiseEvents = true)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<IContent> contents
    System.Int32 userId
    System.Boolean raiseEvents
    Returns
    Type Description
    OperationResult
    View Source

    Save(IContent, Int32, Boolean)

    Saves a document.

    Declaration
    public OperationResult Save(IContent content, int userId = -1, bool raiseEvents = true)
    Parameters
    Type Name Description
    IContent content
    System.Int32 userId
    System.Boolean raiseEvents
    Returns
    Type Description
    OperationResult
    View Source

    SaveAndPublish(IContent, String, Int32, Boolean)

    Saves and publishes a document.

    Declaration
    public PublishResult SaveAndPublish(IContent content, string culture = "*", int userId = -1, bool raiseEvents = true)
    Parameters
    Type Name Description
    IContent content

    The document to publish.

    System.String culture

    The culture to publish.

    System.Int32 userId

    The identifier of the user performing the action.

    System.Boolean raiseEvents

    A value indicating whether to raise events.

    Returns
    Type Description
    PublishResult
    Remarks

    By default, publishes all variations of the document, but it is possible to specify a culture to be published.

    When a culture is being published, it includes all varying values along with all invariant values.

    The document is always saved, even when publishing fails.

    If the content type is variant, then culture can be either '' or an actual culture, but neither 'null' nor 'empty'. If the content type is invariant, then culture can be either '' or null or empty.

    View Source

    SaveAndPublish(IContent, String[], Int32, Boolean)

    Saves and publishes a document.

    Declaration
    public PublishResult SaveAndPublish(IContent content, string[] cultures, int userId = -1, bool raiseEvents = true)
    Parameters
    Type Name Description
    IContent content

    The document to publish.

    System.String[] cultures

    The cultures to publish.

    System.Int32 userId

    The identifier of the user performing the action.

    System.Boolean raiseEvents

    A value indicating whether to raise events.

    Returns
    Type Description
    PublishResult
    Remarks

    By default, publishes all variations of the document, but it is possible to specify a culture to be published.

    When a culture is being published, it includes all varying values along with all invariant values.

    The document is always saved, even when publishing fails.

    View Source

    SaveAndPublishBranch(IContent, Boolean, String, Int32)

    Saves and publishes a document branch.

    Declaration
    public IEnumerable<PublishResult> SaveAndPublishBranch(IContent content, bool force, string culture = "*", int userId = -1)
    Parameters
    Type Name Description
    IContent content

    The root document.

    System.Boolean force

    A value indicating whether to force-publish documents that are not already published.

    System.String culture

    A culture, or "*" for all cultures.

    System.Int32 userId

    The identifier of the user performing the operation.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<PublishResult>
    Remarks

    Unless specified, all cultures are re-published. Otherwise, one culture can be specified. To act on more than one culture, see the other overloads of this method.

    The force parameter determines which documents are published. When false, only those documents that are already published, are republished. When true, all documents are published. The root of the branch is always published, regardless of force.

    View Source

    SaveAndPublishBranch(IContent, Boolean, String[], Int32)

    Saves and publishes a document branch.

    Declaration
    public IEnumerable<PublishResult> SaveAndPublishBranch(IContent content, bool force, string[] cultures, int userId = -1)
    Parameters
    Type Name Description
    IContent content

    The root document.

    System.Boolean force

    A value indicating whether to force-publish documents that are not already published.

    System.String[] cultures

    The cultures to publish.

    System.Int32 userId

    The identifier of the user performing the operation.

    Returns
    Type Description
    System.Collections.Generic.IEnumerable<PublishResult>
    Remarks

    The force parameter determines which documents are published. When false, only those documents that are already published, are republished. When true, all documents are published. The root of the branch is always published, regardless of force.

    View Source

    SaveBlueprint(IContent, Int32)

    Declaration
    public void SaveBlueprint(IContent content, int userId = -1)
    Parameters
    Type Name Description
    IContent content
    System.Int32 userId
    View Source

    SendToPublication(IContent, Int32)

    Sends an IContent to Publication, which executes handlers and events for the 'Send to Publication' action.

    Declaration
    public bool SendToPublication(IContent content, int userId = -1)
    Parameters
    Type Name Description
    IContent content

    The IContent to send to publication

    System.Int32 userId

    Optional Id of the User issuing the send to publication

    Returns
    Type Description
    System.Boolean

    True if sending publication was successful otherwise false

    View Source

    SetPermission(IContent, Char, IEnumerable<Int32>)

    Assigns a single permission to the current content item for the specified group ids

    Declaration
    public void SetPermission(IContent entity, char permission, IEnumerable<int> groupIds)
    Parameters
    Type Name Description
    IContent entity
    System.Char permission
    System.Collections.Generic.IEnumerable<System.Int32> groupIds
    View Source

    SetPermissions(EntityPermissionSet)

    Declaration
    public void SetPermissions(EntityPermissionSet permissionSet)
    Parameters
    Type Name Description
    EntityPermissionSet permissionSet
    View Source

    SetPreventCleanup(Int32, Boolean, Int32)

    Updates preventCleanup value for given content version.

    Declaration
    public void SetPreventCleanup(int versionId, bool preventCleanup, int userId = -1)
    Parameters
    Type Name Description
    System.Int32 versionId
    System.Boolean preventCleanup
    System.Int32 userId
    View Source

    Sort(IEnumerable<Int32>, Int32, Boolean)

    Sorts a collection of IContent objects by updating the SortOrder according to the ordering of items identified by the ids.

    Declaration
    public OperationResult Sort(IEnumerable<int> ids, int userId = -1, bool raiseEvents = true)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.Int32> ids
    System.Int32 userId
    System.Boolean raiseEvents
    Returns
    Type Description
    OperationResult

    Result indicating what action was taken when handling the command.

    Remarks

    Using this method will ensure that the Published-state is maintained upon sorting so the cache is updated accordingly - as needed.

    View Source

    Sort(IEnumerable<IContent>, Int32, Boolean)

    Sorts a collection of IContent objects by updating the SortOrder according to the ordering of items in the passed in items.

    Declaration
    public OperationResult Sort(IEnumerable<IContent> items, int userId = -1, bool raiseEvents = true)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<IContent> items
    System.Int32 userId
    System.Boolean raiseEvents
    Returns
    Type Description
    OperationResult

    Result indicating what action was taken when handling the command.

    Remarks

    Using this method will ensure that the Published-state is maintained upon sorting so the cache is updated accordingly - as needed.

    View Source

    Unpublish(IContent, String, Int32)

    Unpublishes a document.

    Declaration
    public PublishResult Unpublish(IContent content, string culture = "*", int userId = -1)
    Parameters
    Type Name Description
    IContent content
    System.String culture
    System.Int32 userId
    Returns
    Type Description
    PublishResult
    Remarks

    By default, unpublishes the document as a whole, but it is possible to specify a culture to be unpublished. Depending on whether that culture is mandatory, and other cultures remain published, the document as a whole may or may not remain published.

    If the content type is variant, then culture can be either '' or an actual culture, but neither null nor empty. If the content type is invariant, then culture can be either '' or null or empty.

    Events

    View Source

    Copied

    Occurs after Copy

    Declaration
    public static event TypedEventHandler<IContentService, CopyEventArgs<IContent>> Copied
    Event Type
    Type Description
    TypedEventHandler<IContentService, CopyEventArgs<IContent>>
    View Source

    Copying

    Occurs before Copy

    Declaration
    public static event TypedEventHandler<IContentService, CopyEventArgs<IContent>> Copying
    Event Type
    Type Description
    TypedEventHandler<IContentService, CopyEventArgs<IContent>>
    View Source

    Deleted

    Occurs after Delete

    Declaration
    public static event TypedEventHandler<IContentService, DeleteEventArgs<IContent>> Deleted
    Event Type
    Type Description
    TypedEventHandler<IContentService, DeleteEventArgs<IContent>>
    View Source

    DeletedBlueprint

    Occurs after a blueprint has been deleted.

    Declaration
    public static event TypedEventHandler<IContentService, DeleteEventArgs<IContent>> DeletedBlueprint
    Event Type
    Type Description
    TypedEventHandler<IContentService, DeleteEventArgs<IContent>>
    View Source

    DeletedVersions

    Occurs after Delete Versions

    Declaration
    public static event TypedEventHandler<IContentService, DeleteRevisionsEventArgs> DeletedVersions
    Event Type
    Type Description
    TypedEventHandler<IContentService, DeleteRevisionsEventArgs>
    View Source

    Deleting

    Occurs before Delete

    Declaration
    public static event TypedEventHandler<IContentService, DeleteEventArgs<IContent>> Deleting
    Event Type
    Type Description
    TypedEventHandler<IContentService, DeleteEventArgs<IContent>>
    View Source

    DeletingVersions

    Occurs before Delete Versions

    Declaration
    public static event TypedEventHandler<IContentService, DeleteRevisionsEventArgs> DeletingVersions
    Event Type
    Type Description
    TypedEventHandler<IContentService, DeleteRevisionsEventArgs>
    View Source

    EmptiedRecycleBin

    Occurs after the Recycle Bin has been Emptied

    Declaration
    public static event TypedEventHandler<IContentService, RecycleBinEventArgs> EmptiedRecycleBin
    Event Type
    Type Description
    TypedEventHandler<IContentService, RecycleBinEventArgs>
    View Source

    EmptyingRecycleBin

    Occurs before the Recycle Bin is emptied

    Declaration
    public static event TypedEventHandler<IContentService, RecycleBinEventArgs> EmptyingRecycleBin
    Event Type
    Type Description
    TypedEventHandler<IContentService, RecycleBinEventArgs>
    View Source

    Moved

    Occurs after Move

    Declaration
    public static event TypedEventHandler<IContentService, MoveEventArgs<IContent>> Moved
    Event Type
    Type Description
    TypedEventHandler<IContentService, MoveEventArgs<IContent>>
    View Source

    Moving

    Occurs before Move

    Declaration
    public static event TypedEventHandler<IContentService, MoveEventArgs<IContent>> Moving
    Event Type
    Type Description
    TypedEventHandler<IContentService, MoveEventArgs<IContent>>
    View Source

    Published

    Occurs after publish

    Declaration
    public static event TypedEventHandler<IContentService, ContentPublishedEventArgs> Published
    Event Type
    Type Description
    TypedEventHandler<IContentService, ContentPublishedEventArgs>
    View Source

    Publishing

    Occurs before publish

    Declaration
    public static event TypedEventHandler<IContentService, ContentPublishingEventArgs> Publishing
    Event Type
    Type Description
    TypedEventHandler<IContentService, ContentPublishingEventArgs>
    View Source

    RolledBack

    Occurs after Rollback

    Declaration
    public static event TypedEventHandler<IContentService, RollbackEventArgs<IContent>> RolledBack
    Event Type
    Type Description
    TypedEventHandler<IContentService, RollbackEventArgs<IContent>>
    View Source

    RollingBack

    Occurs before Rollback

    Declaration
    public static event TypedEventHandler<IContentService, RollbackEventArgs<IContent>> RollingBack
    Event Type
    Type Description
    TypedEventHandler<IContentService, RollbackEventArgs<IContent>>
    View Source

    Saved

    Occurs after Save

    Declaration
    public static event TypedEventHandler<IContentService, ContentSavedEventArgs> Saved
    Event Type
    Type Description
    TypedEventHandler<IContentService, ContentSavedEventArgs>
    View Source

    SavedBlueprint

    Occurs after a blueprint has been saved.

    Declaration
    public static event TypedEventHandler<IContentService, SaveEventArgs<IContent>> SavedBlueprint
    Event Type
    Type Description
    TypedEventHandler<IContentService, SaveEventArgs<IContent>>
    View Source

    Saving

    Occurs before Save

    Declaration
    public static event TypedEventHandler<IContentService, ContentSavingEventArgs> Saving
    Event Type
    Type Description
    TypedEventHandler<IContentService, ContentSavingEventArgs>
    View Source

    SendingToPublish

    Occurs before Send to Publish

    Declaration
    public static event TypedEventHandler<IContentService, SendToPublishEventArgs<IContent>> SendingToPublish
    Event Type
    Type Description
    TypedEventHandler<IContentService, SendToPublishEventArgs<IContent>>
    View Source

    SentToPublish

    Occurs after Send to Publish

    Declaration
    public static event TypedEventHandler<IContentService, SendToPublishEventArgs<IContent>> SentToPublish
    Event Type
    Type Description
    TypedEventHandler<IContentService, SendToPublishEventArgs<IContent>>
    View Source

    Sorted

    Occurs after Sorting

    Declaration
    public static event TypedEventHandler<IContentService, SaveEventArgs<IContent>> Sorted
    Event Type
    Type Description
    TypedEventHandler<IContentService, SaveEventArgs<IContent>>
    View Source

    Sorting

    Occurs before Sorting

    Declaration
    public static event TypedEventHandler<IContentService, SaveEventArgs<IContent>> Sorting
    Event Type
    Type Description
    TypedEventHandler<IContentService, SaveEventArgs<IContent>>
    View Source

    Trashed

    Occurs after Content is moved to Recycle Bin

    Declaration
    public static event TypedEventHandler<IContentService, MoveEventArgs<IContent>> Trashed
    Event Type
    Type Description
    TypedEventHandler<IContentService, MoveEventArgs<IContent>>
    View Source

    Trashing

    Occurs before Content is moved to Recycle Bin

    Declaration
    public static event TypedEventHandler<IContentService, MoveEventArgs<IContent>> Trashing
    Event Type
    Type Description
    TypedEventHandler<IContentService, MoveEventArgs<IContent>>
    View Source

    TreeChanged

    Occurs after change.

    Declaration
    public static event TypedEventHandler<IContentService, TreeChange<IContent>.EventArgs> TreeChanged
    Event Type
    Type Description
    TypedEventHandler<IContentService, TreeChange.EventArgs<>>
    View Source

    Unpublished

    Occurs after unpublish

    Declaration
    public static event TypedEventHandler<IContentService, PublishEventArgs<IContent>> Unpublished
    Event Type
    Type Description
    TypedEventHandler<IContentService, PublishEventArgs<IContent>>
    View Source

    Unpublishing

    Occurs before unpublish

    Declaration
    public static event TypedEventHandler<IContentService, PublishEventArgs<IContent>> Unpublishing
    Event Type
    Type Description
    TypedEventHandler<IContentService, PublishEventArgs<IContent>>
    • Improve this Doc
    • View Source
    In This Article
    • Constructors
      • ContentService(IScopeProvider, ILogger, IEventMessagesFactory, IDocumentRepository, IEntityRepository, IAuditRepository, IContentTypeRepository, IDocumentBlueprintRepository, ILanguageRepository)
    • Methods
      • CheckDataIntegrity(ContentDataIntegrityReportOptions)
      • Copy(IContent, Int32, Boolean, Boolean, Int32)
      • Copy(IContent, Int32, Boolean, Int32)
      • Count(String)
      • CountChildren(Int32, String)
      • CountDescendants(Int32, String)
      • CountPublished(String)
      • Create(String, Guid, String, Int32)
      • Create(String, Int32, String, Int32)
      • Create(String, Int32, IContentType, Int32)
      • Create(String, IContent, String, Int32)
      • CreateAndSave(String, Int32, String, Int32)
      • CreateAndSave(String, IContent, String, Int32)
      • CreateContentFromBlueprint(IContent, String, Int32)
      • Delete(IContent, Int32)
      • DeleteBlueprint(IContent, Int32)
      • DeleteBlueprintsOfType(Int32, Int32)
      • DeleteBlueprintsOfTypes(IEnumerable<Int32>, Int32)
      • DeleteOfType(Int32, Int32)
      • DeleteOfTypes(IEnumerable<Int32>, Int32)
      • DeleteVersion(Int32, Int32, Boolean, Int32)
      • DeleteVersions(Int32, DateTime, Int32)
      • EmptyRecycleBin()
      • EmptyRecycleBin(Int32)
      • GetAncestors(Int32)
      • GetAncestors(IContent)
      • GetBlueprintById(Guid)
      • GetBlueprintById(Int32)
      • GetBlueprintsForContentTypes(Int32[])
      • GetById(Guid)
      • GetById(Int32)
      • GetByIds(IEnumerable<Guid>)
      • GetByIds(IEnumerable<Int32>)
      • GetByLevel(Int32)
      • GetContentForExpiration(DateTime)
      • GetContentForRelease(DateTime)
      • GetPagedChildren(Int32, Int64, Int32, out Int64, IQuery<IContent>, Ordering)
      • GetPagedContentInRecycleBin(Int64, Int32, out Int64, IQuery<IContent>, Ordering)
      • GetPagedContentVersions(Int32, Int64, Int32, out Int64, String)
      • GetPagedDescendants(Int32, Int64, Int32, out Int64, IQuery<IContent>, Ordering)
      • GetPagedOfType(Int32, Int64, Int32, out Int64, IQuery<IContent>, Ordering)
      • GetPagedOfTypes(Int32[], Int64, Int32, out Int64, IQuery<IContent>, Ordering)
      • GetParent(Int32)
      • GetParent(IContent)
      • GetPermissions(IContent)
      • GetPublishedChildren(Int32)
      • GetRootContent()
      • GetVersion(Int32)
      • GetVersionIds(Int32, Int32)
      • GetVersions(Int32)
      • GetVersionsSlim(Int32, Int32, Int32)
      • HasChildren(Int32)
      • IsPathPublishable(IContent)
      • IsPathPublished(IContent)
      • Move(IContent, Int32, Int32)
      • MoveToRecycleBin(IContent, Int32)
      • PerformContentVersionCleanup(DateTime)
      • PerformScheduledPublish(DateTime)
      • RecycleBinSmells()
      • Rollback(Int32, Int32, String, Int32)
      • Save(IEnumerable<IContent>, Int32, Boolean)
      • Save(IContent, Int32, Boolean)
      • SaveAndPublish(IContent, String, Int32, Boolean)
      • SaveAndPublish(IContent, String[], Int32, Boolean)
      • SaveAndPublishBranch(IContent, Boolean, String, Int32)
      • SaveAndPublishBranch(IContent, Boolean, String[], Int32)
      • SaveBlueprint(IContent, Int32)
      • SendToPublication(IContent, Int32)
      • SetPermission(IContent, Char, IEnumerable<Int32>)
      • SetPermissions(EntityPermissionSet)
      • SetPreventCleanup(Int32, Boolean, Int32)
      • Sort(IEnumerable<Int32>, Int32, Boolean)
      • Sort(IEnumerable<IContent>, Int32, Boolean)
      • Unpublish(IContent, String, Int32)
    • Events
      • Copied
      • Copying
      • Deleted
      • DeletedBlueprint
      • DeletedVersions
      • Deleting
      • DeletingVersions
      • EmptiedRecycleBin
      • EmptyingRecycleBin
      • Moved
      • Moving
      • Published
      • Publishing
      • RolledBack
      • RollingBack
      • Saved
      • SavedBlueprint
      • Saving
      • SendingToPublish
      • SentToPublish
      • Sorted
      • Sorting
      • Trashed
      • Trashing
      • TreeChanged
      • Unpublished
      • Unpublishing
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX