Interface IContentService
Defines the ContentService, which is an easy access to operations involving IContent
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public interface IContentService : IContentServiceBase<IContent>, IContentServiceBase, IService
Methods
View SourceCopy(IContent, int, bool, bool, int)
Copies a document.
Declaration
IContent? Copy(IContent content, int parentId, bool relateToOriginal, bool recursive, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | content | |
| int | parentId | |
| bool | relateToOriginal | |
| bool | recursive | |
| int | userId |
Returns
| Type | Description |
|---|---|
| IContent |
Remarks
Optionally recursively copies all children.
Copy(IContent, int, bool, int)
Copies a document.
Declaration
IContent? Copy(IContent content, int parentId, bool relateToOriginal, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | content | |
| int | parentId | |
| bool | relateToOriginal | |
| int | userId |
Returns
| Type | Description |
|---|---|
| IContent |
Remarks
Recursively copies all children.
Count(string?)
Counts documents of a given document type.
Declaration
int Count(string? documentTypeAlias = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | documentTypeAlias |
Returns
| Type | Description |
|---|---|
| int |
CountChildren(int, string?)
Counts child documents of a given parent, of a given document type.
Declaration
int CountChildren(int parentId, string? documentTypeAlias = null)
Parameters
| Type | Name | Description |
|---|---|---|
| int | parentId | |
| string | documentTypeAlias |
Returns
| Type | Description |
|---|---|
| int |
CountDescendants(int, string?)
Counts descendant documents of a given parent, of a given document type.
Declaration
int CountDescendants(int parentId, string? documentTypeAlias = null)
Parameters
| Type | Name | Description |
|---|---|---|
| int | parentId | |
| string | documentTypeAlias |
Returns
| Type | Description |
|---|---|
| int |
CountPublished(string?)
Counts published documents of a given document type.
Declaration
int CountPublished(string? documentTypeAlias = null)
Parameters
| Type | Name | Description |
|---|---|---|
| string | documentTypeAlias |
Returns
| Type | Description |
|---|---|
| int |
Create(string, Guid, string, int)
Creates a document.
Declaration
IContent Create(string name, Guid parentId, string documentTypeAlias, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| Guid | parentId | |
| string | documentTypeAlias | |
| int | userId |
Returns
| Type | Description |
|---|---|
| IContent |
Create(string, int, string, int)
Creates a document.
Declaration
IContent Create(string name, int parentId, string documentTypeAlias, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| int | parentId | |
| string | documentTypeAlias | |
| int | userId |
Returns
| Type | Description |
|---|---|
| IContent |
Create(string, int, IContentType, int)
Creates a document
Declaration
IContent Create(string name, int parentId, IContentType contentType, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| int | parentId | |
| IContentType | contentType | |
| int | userId |
Returns
| Type | Description |
|---|---|
| IContent |
Create(string, IContent?, string, int)
Creates a document.
Declaration
IContent Create(string name, IContent? parent, string documentTypeAlias, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| IContent | parent | |
| string | documentTypeAlias | |
| int | userId |
Returns
| Type | Description |
|---|---|
| IContent |
CreateAndSave(string, int, string, int)
Creates and saves a document.
Declaration
IContent CreateAndSave(string name, int parentId, string contentTypeAlias, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| int | parentId | |
| string | contentTypeAlias | |
| int | userId |
Returns
| Type | Description |
|---|---|
| IContent |
CreateAndSave(string, IContent, string, int)
Creates and saves a document.
Declaration
IContent CreateAndSave(string name, IContent parent, string contentTypeAlias, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| string | name | |
| IContent | parent | |
| string | contentTypeAlias | |
| int | userId |
Returns
| Type | Description |
|---|---|
| IContent |
CreateBlueprintFromContent(IContent, string, int)
Creates a blueprint from a content item.
Declaration
IContent CreateBlueprintFromContent(IContent blueprint, string name, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | blueprint | |
| string | name | |
| int | userId |
Returns
| Type | Description |
|---|---|
| IContent |
CreateContentFromBlueprint(IContent, string, int)
(Deprecated) Creates a new content item from a blueprint.
Declaration
[Obsolete("Use IContentBlueprintEditingService.GetScaffoldedAsync() instead. Scheduled for removal in V18.")]
IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | blueprint | |
| string | name | |
| int | userId |
Returns
| Type | Description |
|---|---|
| IContent |
Remarks
If creating content from a blueprint, use GetScaffoldedAsync(Guid) instead. If creating a blueprint from content use CreateBlueprintFromContent(IContent, string, int) instead.
Delete(IContent, int)
Deletes a document.
Declaration
OperationResult Delete(IContent content, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | content | |
| int | 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.
DeleteBlueprint(IContent, int)
Deletes a blueprint.
Declaration
void DeleteBlueprint(IContent content, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | content | |
| int | userId |
DeleteBlueprintsOfType(int, int)
Deletes blueprints for a content type.
Declaration
void DeleteBlueprintsOfType(int contentTypeId, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| int | contentTypeId | |
| int | userId |
DeleteBlueprintsOfTypes(IEnumerable<int>, int)
Deletes blueprints for content types.
Declaration
void DeleteBlueprintsOfTypes(IEnumerable<int> contentTypeIds, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<int> | contentTypeIds | |
| int | userId |
DeleteOfType(int, int)
Deletes all documents of a given document type.
Declaration
void DeleteOfType(int documentTypeId, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| int | documentTypeId | |
| int | userId |
Remarks
All non-deleted descendants of the deleted documents are moved to the recycle bin.
This operation is potentially dangerous and expensive.
DeleteOfTypes(IEnumerable<int>, int)
Deletes all documents of given document types.
Declaration
void DeleteOfTypes(IEnumerable<int> contentTypeIds, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<int> | contentTypeIds | |
| int | userId |
Remarks
All non-deleted descendants of the deleted documents are moved to the recycle bin.
This operation is potentially dangerous and expensive.
DeleteVersion(int, int, bool, int)
Deletes a version of a document.
Declaration
void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | |
| int | versionId | |
| bool | deletePriorVersions | |
| int | userId |
DeleteVersions(int, DateTime, int)
Deletes versions of a document prior to a given date.
Declaration
void DeleteVersions(int id, DateTime date, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | |
| DateTime | date | |
| int | userId |
EmptyRecycleBin(int)
Empties the Recycle Bin by deleting all IContent that resides in the bin
Declaration
OperationResult EmptyRecycleBin(int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| int | userId | Optional Id of the User emptying the Recycle Bin |
Returns
| Type | Description |
|---|---|
| OperationResult |
EmptyRecycleBinAsync(Guid)
Declaration
Task<OperationResult> EmptyRecycleBinAsync(Guid userId)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | userId |
Returns
| Type | Description |
|---|---|
| Task<OperationResult> |
GetAncestors(int)
Gets ancestor documents of a document.
Declaration
IEnumerable<IContent> GetAncestors(int id)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id |
Returns
| Type | Description |
|---|---|
| IEnumerable<IContent> |
GetAncestors(IContent)
Gets ancestor documents of a document.
Declaration
IEnumerable<IContent> GetAncestors(IContent content)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | content |
Returns
| Type | Description |
|---|---|
| IEnumerable<IContent> |
GetBlueprintById(Guid)
Gets a blueprint.
Declaration
IContent? GetBlueprintById(Guid id)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | id |
Returns
| Type | Description |
|---|---|
| IContent |
GetBlueprintById(int)
Gets a blueprint.
Declaration
IContent? GetBlueprintById(int id)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id |
Returns
| Type | Description |
|---|---|
| IContent |
GetBlueprintsForContentTypes(params int[])
Gets blueprints for a content type.
Declaration
IEnumerable<IContent> GetBlueprintsForContentTypes(params int[] documentTypeId)
Parameters
| Type | Name | Description |
|---|---|---|
| int[] | documentTypeId |
Returns
| Type | Description |
|---|---|
| IEnumerable<IContent> |
GetById(Guid)
Gets a document.
Declaration
IContent? GetById(Guid key)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key |
Returns
| Type | Description |
|---|---|
| IContent |
GetById(int)
Gets a document.
Declaration
IContent? GetById(int id)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id |
Returns
| Type | Description |
|---|---|
| IContent |
GetByIds(IEnumerable<Guid>)
Gets documents.
Declaration
IEnumerable<IContent> GetByIds(IEnumerable<Guid> ids)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<Guid> | ids |
Returns
| Type | Description |
|---|---|
| IEnumerable<IContent> |
GetByIds(IEnumerable<int>)
Gets documents.
Declaration
IEnumerable<IContent> GetByIds(IEnumerable<int> ids)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<int> | ids |
Returns
| Type | Description |
|---|---|
| IEnumerable<IContent> |
GetByLevel(int)
Gets documents at a given level.
Declaration
IEnumerable<IContent> GetByLevel(int level)
Parameters
| Type | Name | Description |
|---|---|---|
| int | level |
Returns
| Type | Description |
|---|---|
| IEnumerable<IContent> |
GetContentForExpiration(DateTime)
Gets documents having an expiration date before (lower than, or equal to) a specified date.
Declaration
IEnumerable<IContent> GetContentForExpiration(DateTime date)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | date |
Returns
| Type | Description |
|---|---|
| IEnumerable<IContent> | An Enumerable list of IContent objects |
Remarks
The content returned from this method may be culture variant, in which case you can use GetStatus(IContent, ContentScheduleCollection, string?) to get the status for a specific culture.
GetContentForRelease(DateTime)
Gets documents having a release date before (lower than, or equal to) a specified date.
Declaration
IEnumerable<IContent> GetContentForRelease(DateTime date)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | date |
Returns
| Type | Description |
|---|---|
| IEnumerable<IContent> | An Enumerable list of IContent objects |
Remarks
The content returned from this method may be culture variant, in which case you can use GetStatus(IContent, ContentScheduleCollection, string?) to get the status for a specific culture.
GetContentScheduleByContentId(Guid)
Declaration
ContentScheduleCollection GetContentScheduleByContentId(Guid contentId)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | contentId |
Returns
| Type | Description |
|---|---|
| ContentScheduleCollection |
GetContentScheduleByContentId(int)
Gets publish/unpublish schedule for a content node.
Declaration
ContentScheduleCollection GetContentScheduleByContentId(int contentId)
Parameters
| Type | Name | Description |
|---|---|---|
| int | contentId | Id of the Content to load schedule for |
Returns
| Type | Description |
|---|---|
| ContentScheduleCollection |
GetContentSchedulesByIds(Guid[])
Gets a dictionary of content Ids and their matching content schedules.
Declaration
IDictionary<int, IEnumerable<ContentSchedule>> GetContentSchedulesByIds(Guid[] keys)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid[] | keys | The content keys. |
Returns
| Type | Description |
|---|---|
| IDictionary<int, IEnumerable<ContentSchedule>> | A dictionary with a nodeId and an IEnumerable of matching ContentSchedules. |
GetPagedChildren(int, long, int, out long, IQuery<IContent>?, Ordering?)
Gets child documents of a parent.
Declaration
IEnumerable<IContent> GetPagedChildren(int id, long pageIndex, int pageSize, out long totalRecords, IQuery<IContent>? filter = null, Ordering? ordering = null)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | The parent identifier. |
| long | pageIndex | The page number. |
| int | pageSize | The page size. |
| long | totalRecords | Total number of documents. |
| IQuery<IContent> | filter | Query filter. |
| Ordering | ordering | Ordering infos. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IContent> |
GetPagedContentInRecycleBin(long, int, out long, IQuery<IContent>?, Ordering?)
Gets documents in the recycle bin.
Declaration
IEnumerable<IContent> GetPagedContentInRecycleBin(long pageIndex, int pageSize, out long totalRecords, IQuery<IContent>? filter = null, Ordering? ordering = null)
Parameters
| Type | Name | Description |
|---|---|---|
| long | pageIndex | |
| int | pageSize | |
| long | totalRecords | |
| IQuery<IContent> | filter | |
| Ordering | ordering |
Returns
| Type | Description |
|---|---|
| IEnumerable<IContent> |
GetPagedDescendants(int, long, int, out long, IQuery<IContent>?, Ordering?)
Gets descendant documents of a given parent.
Declaration
IEnumerable<IContent> GetPagedDescendants(int id, long pageIndex, int pageSize, out long totalRecords, IQuery<IContent>? filter = null, Ordering? ordering = null)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | The parent identifier. |
| long | pageIndex | The page number. |
| int | pageSize | The page size. |
| long | totalRecords | Total number of documents. |
| IQuery<IContent> | filter | Query filter. |
| Ordering | ordering | Ordering infos. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IContent> |
GetPagedOfType(int, long, int, out long, IQuery<IContent>, Ordering?)
Gets paged documents of a content
Declaration
IEnumerable<IContent> GetPagedOfType(int contentTypeId, long pageIndex, int pageSize, out long totalRecords, IQuery<IContent> filter, Ordering? ordering = null)
Parameters
| Type | Name | Description |
|---|---|---|
| int | contentTypeId | The page number. |
| long | pageIndex | The page number. |
| int | pageSize | The page size. |
| long | totalRecords | Total number of documents. |
| IQuery<IContent> | filter | Search text filter. |
| Ordering | ordering | Ordering infos. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IContent> |
GetPagedOfTypes(int[], long, int, out long, IQuery<IContent>?, Ordering?)
Gets paged documents for specified content types
Declaration
IEnumerable<IContent> GetPagedOfTypes(int[] contentTypeIds, long pageIndex, int pageSize, out long totalRecords, IQuery<IContent>? filter, Ordering? ordering = null)
Parameters
| Type | Name | Description |
|---|---|---|
| int[] | contentTypeIds | The page number. |
| long | pageIndex | The page number. |
| int | pageSize | The page size. |
| long | totalRecords | Total number of documents. |
| IQuery<IContent> | filter | Search text filter. |
| Ordering | ordering | Ordering infos. |
Returns
| Type | Description |
|---|---|
| IEnumerable<IContent> |
GetParent(int)
Gets the parent of a document.
Declaration
IContent? GetParent(int id)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id |
Returns
| Type | Description |
|---|---|
| IContent |
GetParent(IContent)
Gets the parent of a document.
Declaration
IContent? GetParent(IContent content)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | content |
Returns
| Type | Description |
|---|---|
| IContent |
GetPermissions(IContent)
Gets permissions assigned to a document.
Declaration
EntityPermissionCollection GetPermissions(IContent content)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | content |
Returns
| Type | Description |
|---|---|
| EntityPermissionCollection |
GetRootContent()
Gets root-level documents.
Declaration
IEnumerable<IContent> GetRootContent()
Returns
| Type | Description |
|---|---|
| IEnumerable<IContent> |
GetVersion(int)
Gets a version of a document.
Declaration
IContent? GetVersion(int versionId)
Parameters
| Type | Name | Description |
|---|---|---|
| int | versionId |
Returns
| Type | Description |
|---|---|
| IContent |
GetVersionIds(int, int)
Gets top versions of a document.
Declaration
IEnumerable<int> GetVersionIds(int id, int topRows)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | |
| int | topRows |
Returns
| Type | Description |
|---|---|
| IEnumerable<int> |
Remarks
Versions are ordered with current first, then most recent first.
GetVersions(int)
Gets all versions of a document.
Declaration
IEnumerable<IContent> GetVersions(int id)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id |
Returns
| Type | Description |
|---|---|
| IEnumerable<IContent> |
Remarks
Versions are ordered with current first, then most recent first.
GetVersionsSlim(int, int, int)
Gets all versions of a document.
Declaration
IEnumerable<IContent> GetVersionsSlim(int id, int skip, int take)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | |
| int | skip | |
| int | take |
Returns
| Type | Description |
|---|---|
| IEnumerable<IContent> |
Remarks
Versions are ordered with current first, then most recent first.
HasChildren(int)
Gets a value indicating whether a document has children.
Declaration
bool HasChildren(int id)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id |
Returns
| Type | Description |
|---|---|
| bool |
IsPathPublishable(IContent)
Gets a value indicating whether a document is path-publishable.
Declaration
bool IsPathPublishable(IContent content)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | content |
Returns
| Type | Description |
|---|---|
| bool |
Remarks
A document is path-publishable when all its ancestors are published.
IsPathPublished(IContent)
Gets a value indicating whether a document is path-published.
Declaration
bool IsPathPublished(IContent content)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | content |
Returns
| Type | Description |
|---|---|
| bool |
Remarks
A document is path-published when all its ancestors, and the document itself, are published.
Move(IContent, int, int)
Moves a document under a new parent.
Declaration
OperationResult Move(IContent content, int parentId, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | content | |
| int | parentId | |
| int | userId |
Returns
| Type | Description |
|---|---|
| OperationResult |
MoveToRecycleBin(IContent, int)
Moves a document to the recycle bin.
Declaration
OperationResult MoveToRecycleBin(IContent content, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | content | |
| int | userId |
Returns
| Type | Description |
|---|---|
| OperationResult |
PerformScheduledPublish(DateTime)
Publishes and unpublishes scheduled documents.
Declaration
IEnumerable<PublishResult> PerformScheduledPublish(DateTime date)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | date |
Returns
| Type | Description |
|---|---|
| IEnumerable<PublishResult> |
PersistContentSchedule(IContent, ContentScheduleCollection)
Persists publish/unpublish schedule for a content node.
Declaration
void PersistContentSchedule(IContent content, ContentScheduleCollection contentSchedule)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | content | |
| ContentScheduleCollection | contentSchedule |
Publish(IContent, string[], int)
Publishes a document.
Declaration
PublishResult Publish(IContent content, string[] cultures, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | content | The document to publish. |
| string[] | cultures | The cultures to publish. |
| int | userId | The identifier of the user performing the action. |
Returns
| Type | Description |
|---|---|
| PublishResult |
Remarks
When a culture is being published, it includes all varying values along with all invariant values.
Wildcards (*) can be used as culture identifier to publish all cultures.
An empty array (or a wildcard) can be passed for culture invariant content.
PublishBranch(IContent, PublishBranchFilter, string[], int)
Publishes a document branch.
Declaration
IEnumerable<PublishResult> PublishBranch(IContent content, PublishBranchFilter publishBranchFilter, string[] cultures, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | content | The root document. |
| PublishBranchFilter | publishBranchFilter | A value indicating options for force publishing unpublished or re-publishing unchanged content. |
| string[] | cultures | The cultures to publish. |
| int | userId | The identifier of the user performing the operation. |
Returns
| Type | Description |
|---|---|
| IEnumerable<PublishResult> |
Remarks
The root of the branch is always published, regardless of publishBranchFilter.
RecycleBinSmells()
Returns true if there is any content in the recycle bin
Declaration
bool RecycleBinSmells()
Returns
| Type | Description |
|---|---|
| bool |
Rollback(int, int, string, int)
Rolls back the content to a specific version.
Declaration
OperationResult Rollback(int id, int versionId, string culture = "*", int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| int | id | The id of the content node. |
| int | versionId | The version id to roll back to. |
| string | culture | An optional culture to roll back. |
| int | userId | The identifier of the user who is performing the roll back. |
Returns
| Type | Description |
|---|---|
| OperationResult |
Remarks
When no culture is specified, all cultures are rolled back.
Save(IEnumerable<IContent>, int)
Saves documents.
Declaration
OperationResult Save(IEnumerable<IContent> contents, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IContent> | contents | |
| int | userId |
Returns
| Type | Description |
|---|---|
| OperationResult |
Save(IContent, int?, ContentScheduleCollection?)
Saves a document.
Declaration
OperationResult Save(IContent content, int? userId = null, ContentScheduleCollection? contentSchedule = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | content | |
| int? | userId | |
| ContentScheduleCollection | contentSchedule |
Returns
| Type | Description |
|---|---|
| OperationResult |
SaveBlueprint(IContent, int)
Saves a blueprint.
Declaration
[Obsolete("Please use the method taking all parameters. Scheduled for removal in Umbraco 18.")]
void SaveBlueprint(IContent content, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | content | |
| int | userId |
SaveBlueprint(IContent, IContent?, int)
Saves a blueprint.
Declaration
void SaveBlueprint(IContent content, IContent? createdFromContent, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | content | |
| IContent | createdFromContent | |
| int | userId |
SendToPublication(IContent?, int)
Saves a document and raises the "sent to publication" events.
Declaration
bool SendToPublication(IContent? content, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | content | |
| int | userId |
Returns
| Type | Description |
|---|---|
| bool |
SetPermission(IContent, string, IEnumerable<int>)
Assigns a permission to a document.
Declaration
void SetPermission(IContent entity, string permission, IEnumerable<int> groupIds)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | entity | |
| string | permission | |
| IEnumerable<int> | groupIds |
Remarks
Adds the permission to existing permissions.
SetPermissions(EntityPermissionSet)
Sets the permission of a document.
Declaration
void SetPermissions(EntityPermissionSet permissionSet)
Parameters
| Type | Name | Description |
|---|---|---|
| EntityPermissionSet | permissionSet |
Remarks
Replaces all permissions with the new set of permissions.
Sort(IEnumerable<int>?, int)
Sorts documents.
Declaration
OperationResult Sort(IEnumerable<int>? ids, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<int> | ids | |
| int | userId |
Returns
| Type | Description |
|---|---|
| OperationResult |
Sort(IEnumerable<IContent>, int)
Sorts documents.
Declaration
OperationResult Sort(IEnumerable<IContent> items, int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IEnumerable<IContent> | items | |
| int | userId |
Returns
| Type | Description |
|---|---|
| OperationResult |
Unpublish(IContent, string?, int)
Unpublishes a document.
Declaration
PublishResult Unpublish(IContent content, string? culture = "*", int userId = -1)
Parameters
| Type | Name | Description |
|---|---|---|
| IContent | content | |
| string | culture | |
| int | 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.