View Source
Interface IContentService
Defines the ContentService, which is an easy access to operations involving IContent
Assembly: Umbraco.Core.dll
Syntax
public interface IContentService : IContentServiceBase<IContent>, IContentServiceBase, IService
Methods
View Source
Copy(IContent, Int32, Boolean, Boolean, Int32)
Declaration
IContent Copy(IContent content, int parentId, bool relateToOriginal, bool recursive, int userId = -1)
Parameters
Type |
Name |
Description |
IContent |
content |
|
System.Int32 |
parentId |
|
System.Boolean |
relateToOriginal |
|
System.Boolean |
recursive |
|
System.Int32 |
userId |
|
Returns
View Source
Copy(IContent, Int32, Boolean, Int32)
Declaration
IContent Copy(IContent content, int parentId, bool relateToOriginal, int userId = -1)
Parameters
Type |
Name |
Description |
IContent |
content |
|
System.Int32 |
parentId |
|
System.Boolean |
relateToOriginal |
|
System.Int32 |
userId |
|
Returns
View Source
Count(String)
Counts documents of a given document type.
Declaration
int Count(string documentTypeAlias = null)
Parameters
Type |
Name |
Description |
System.String |
documentTypeAlias |
|
Returns
Type |
Description |
System.Int32 |
|
View Source
CountChildren(Int32, 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 |
System.Int32 |
parentId |
|
System.String |
documentTypeAlias |
|
Returns
Type |
Description |
System.Int32 |
|
View Source
CountDescendants(Int32, 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 |
System.Int32 |
parentId |
|
System.String |
documentTypeAlias |
|
Returns
Type |
Description |
System.Int32 |
|
View Source
CountPublished(String)
Counts published documents of a given document type.
Declaration
int CountPublished(string documentTypeAlias = null)
Parameters
Type |
Name |
Description |
System.String |
documentTypeAlias |
|
Returns
Type |
Description |
System.Int32 |
|
View Source
Create(String, Guid, String, Int32)
Declaration
IContent Create(string name, Guid parentId, string documentTypeAlias, int userId = -1)
Parameters
Type |
Name |
Description |
System.String |
name |
|
Guid |
parentId |
|
System.String |
documentTypeAlias |
|
System.Int32 |
userId |
|
Returns
View Source
Create(String, Int32, String, Int32)
Declaration
IContent Create(string name, int parentId, string documentTypeAlias, int userId = -1)
Parameters
Type |
Name |
Description |
System.String |
name |
|
System.Int32 |
parentId |
|
System.String |
documentTypeAlias |
|
System.Int32 |
userId |
|
Returns
View Source
Create(String, Int32, IContentType, Int32)
Declaration
IContent Create(string name, int parentId, IContentType contentType, int userId = -1)
Parameters
Type |
Name |
Description |
System.String |
name |
|
System.Int32 |
parentId |
|
IContentType |
contentType |
|
System.Int32 |
userId |
|
Returns
View Source
Create(String, IContent, String, Int32)
Declaration
IContent Create(string name, IContent parent, string documentTypeAlias, int userId = -1)
Parameters
Type |
Name |
Description |
System.String |
name |
|
IContent |
parent |
|
System.String |
documentTypeAlias |
|
System.Int32 |
userId |
|
Returns
View Source
CreateAndSave(String, Int32, String, Int32)
Creates and saves a document.
Declaration
IContent CreateAndSave(string name, int parentId, string contentTypeAlias, int userId = -1)
Parameters
Type |
Name |
Description |
System.String |
name |
|
System.Int32 |
parentId |
|
System.String |
contentTypeAlias |
|
System.Int32 |
userId |
|
Returns
View Source
CreateAndSave(String, IContent, String, Int32)
Creates and saves a document.
Declaration
IContent CreateAndSave(string name, IContent parent, string contentTypeAlias, int userId = -1)
Parameters
Type |
Name |
Description |
System.String |
name |
|
IContent |
parent |
|
System.String |
contentTypeAlias |
|
System.Int32 |
userId |
|
Returns
View Source
CreateContentFromBlueprint(IContent, String, Int32)
Creates a new content item from a blueprint.
Declaration
IContent CreateContentFromBlueprint(IContent blueprint, string name, int userId = -1)
Parameters
Type |
Name |
Description |
IContent |
blueprint |
|
System.String |
name |
|
System.Int32 |
userId |
|
Returns
View Source
Delete(IContent, Int32)
Declaration
OperationResult Delete(IContent content, int userId = -1)
Parameters
Type |
Name |
Description |
IContent |
content |
|
System.Int32 |
userId |
|
Returns
View Source
DeleteBlueprint(IContent, Int32)
Declaration
void DeleteBlueprint(IContent content, int userId = -1)
Parameters
Type |
Name |
Description |
IContent |
content |
|
System.Int32 |
userId |
|
View Source
DeleteBlueprintsOfType(Int32, Int32)
Deletes blueprints for a content type.
Declaration
void DeleteBlueprintsOfType(int contentTypeId, int userId = -1)
Parameters
Type |
Name |
Description |
System.Int32 |
contentTypeId |
|
System.Int32 |
userId |
|
View Source
DeleteBlueprintsOfTypes(IEnumerable<Int32>, Int32)
Deletes blueprints for content types.
Declaration
void DeleteBlueprintsOfTypes(IEnumerable<int> contentTypeIds, int userId = -1)
Parameters
Type |
Name |
Description |
IEnumerable<System.Int32> |
contentTypeIds |
|
System.Int32 |
userId |
|
View Source
DeleteOfType(Int32, Int32)
Deletes all documents of a given document type.
Declaration
void DeleteOfType(int documentTypeId, int userId = -1)
Parameters
Type |
Name |
Description |
System.Int32 |
documentTypeId |
|
System.Int32 |
userId |
|
View Source
DeleteOfTypes(IEnumerable<Int32>, Int32)
Deletes all documents of given document types.
Declaration
void DeleteOfTypes(IEnumerable<int> contentTypeIds, int userId = -1)
Parameters
Type |
Name |
Description |
IEnumerable<System.Int32> |
contentTypeIds |
|
System.Int32 |
userId |
|
View Source
DeleteVersion(Int32, Int32, Boolean, Int32)
Deletes a version of a document.
Declaration
void DeleteVersion(int id, int versionId, bool deletePriorVersions, int userId = -1)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
System.Int32 |
versionId |
|
System.Boolean |
deletePriorVersions |
|
System.Int32 |
userId |
|
View Source
DeleteVersions(Int32, DateTime, Int32)
Deletes versions of a document prior to a given date.
Declaration
void DeleteVersions(int id, DateTime date, int userId = -1)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
DateTime |
date |
|
System.Int32 |
userId |
|
View Source
EmptyRecycleBin(Int32)
Empties the Recycle Bin by deleting all IContent that resides in the bin
Declaration
OperationResult EmptyRecycleBin(int userId = -1)
Parameters
Type |
Name |
Description |
System.Int32 |
userId |
Optional Id of the User emptying the Recycle Bin
|
Returns
View Source
EmptyRecycleBinAsync(Guid)
Declaration
Task<OperationResult> EmptyRecycleBinAsync(Guid userId)
Parameters
Type |
Name |
Description |
Guid |
userId |
|
Returns
View Source
GetAncestors(Int32)
Gets ancestor documents of a document.
Declaration
IEnumerable<IContent> GetAncestors(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
Returns
View Source
GetAncestors(IContent)
Gets ancestor documents of a document.
Declaration
IEnumerable<IContent> GetAncestors(IContent content)
Parameters
Returns
View Source
GetBlueprintById(Guid)
Declaration
IContent GetBlueprintById(Guid id)
Parameters
Type |
Name |
Description |
Guid |
id |
|
Returns
View Source
GetBlueprintById(Int32)
Declaration
IContent GetBlueprintById(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
Returns
View Source
GetBlueprintsForContentTypes(Int32[])
Gets blueprints for a content type.
Declaration
IEnumerable<IContent> GetBlueprintsForContentTypes(params int[] documentTypeId)
Parameters
Type |
Name |
Description |
System.Int32[] |
documentTypeId |
|
Returns
View Source
GetById(Guid)
Declaration
IContent GetById(Guid key)
Parameters
Type |
Name |
Description |
Guid |
key |
|
Returns
View Source
GetById(Int32)
Declaration
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
Returns
View Source
GetByIds(IEnumerable<Guid>)
Declaration
IEnumerable<IContent> GetByIds(IEnumerable<Guid> ids)
Parameters
Type |
Name |
Description |
IEnumerable<Guid> |
ids |
|
Returns
View Source
GetByIds(IEnumerable<Int32>)
Declaration
IEnumerable<IContent> GetByIds(IEnumerable<int> ids)
Parameters
Type |
Name |
Description |
IEnumerable<System.Int32> |
ids |
|
Returns
View Source
GetByLevel(Int32)
Gets documents at a given level.
Declaration
IEnumerable<IContent> GetByLevel(int level)
Parameters
Type |
Name |
Description |
System.Int32 |
level |
|
Returns
View Source
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
View Source
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
View Source
GetContentScheduleByContentId(Int32)
Gets publish/unpublish schedule for a content node.
Declaration
ContentScheduleCollection GetContentScheduleByContentId(int contentId)
Parameters
Type |
Name |
Description |
System.Int32 |
contentId |
Id of the Content to load schedule for
|
Returns
View Source
GetPagedChildren(Int32, Int64, Int32, out Int64, 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 |
System.Int32 |
id |
The parent identifier.
|
System.Int64 |
pageIndex |
The page number.
|
System.Int32 |
pageSize |
The page size.
|
System.Int64 |
totalRecords |
Total number of documents.
|
IQuery<IContent> |
filter |
Query filter.
|
Ordering |
ordering |
Ordering infos.
|
Returns
View Source
GetPagedContentInRecycleBin(Int64, Int32, out Int64, 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 |
System.Int64 |
pageIndex |
|
System.Int32 |
pageSize |
|
System.Int64 |
totalRecords |
|
IQuery<IContent> |
filter |
|
Ordering |
ordering |
|
Returns
View Source
GetPagedDescendants(Int32, Int64, Int32, out Int64, 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 |
System.Int32 |
id |
The parent identifier.
|
System.Int64 |
pageIndex |
The page number.
|
System.Int32 |
pageSize |
The page size.
|
System.Int64 |
totalRecords |
Total number of documents.
|
IQuery<IContent> |
filter |
Query filter.
|
Ordering |
ordering |
Ordering infos.
|
Returns
View Source
GetPagedOfType(Int32, Int64, Int32, out Int64, 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 |
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
View Source
GetPagedOfTypes(Int32[], Int64, Int32, out Int64, 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 |
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
View Source
GetParent(Int32)
Gets the parent of a document.
Declaration
IContent GetParent(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
Returns
View Source
GetParent(IContent)
Gets the parent of a document.
Declaration
IContent GetParent(IContent content)
Parameters
Returns
View Source
GetPermissions(IContent)
Gets permissions assigned to a document.
Declaration
EntityPermissionCollection GetPermissions(IContent content)
Parameters
Returns
View Source
GetRootContent()
Gets root-level documents.
Declaration
IEnumerable<IContent> GetRootContent()
Returns
View Source
GetVersion(Int32)
Gets a version of a document.
Declaration
IContent GetVersion(int versionId)
Parameters
Type |
Name |
Description |
System.Int32 |
versionId |
|
Returns
View Source
GetVersionIds(Int32, Int32)
Gets top versions of a document.
Declaration
IEnumerable<int> GetVersionIds(int id, int topRows)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
System.Int32 |
topRows |
|
Returns
Type |
Description |
IEnumerable<System.Int32> |
|
View Source
GetVersions(Int32)
Gets all versions of a document.
Declaration
IEnumerable<IContent> GetVersions(int id)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
Returns
View Source
GetVersionsSlim(Int32, Int32, Int32)
Gets all versions of a document.
Declaration
IEnumerable<IContent> GetVersionsSlim(int id, int skip, int take)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
System.Int32 |
skip |
|
System.Int32 |
take |
|
Returns
View Source
HasChildren(Int32)
Gets a value indicating whether a document has children.
Declaration
Parameters
Type |
Name |
Description |
System.Int32 |
id |
|
Returns
Type |
Description |
System.Boolean |
|
View Source
IsPathPublishable(IContent)
Gets a value indicating whether a document is path-publishable.
Declaration
bool IsPathPublishable(IContent content)
Parameters
Returns
Type |
Description |
System.Boolean |
|
View Source
IsPathPublished(IContent)
Gets a value indicating whether a document is path-published.
Declaration
bool IsPathPublished(IContent content)
Parameters
Returns
Type |
Description |
System.Boolean |
|
View Source
Move(IContent, Int32, Int32)
Moves a document under a new parent.
Declaration
OperationResult Move(IContent content, int parentId, int userId = -1)
Parameters
Type |
Name |
Description |
IContent |
content |
|
System.Int32 |
parentId |
|
System.Int32 |
userId |
|
Returns
View Source
MoveToRecycleBin(IContent, Int32)
Moves a document to the recycle bin.
Declaration
OperationResult MoveToRecycleBin(IContent content, int userId = -1)
Parameters
Type |
Name |
Description |
IContent |
content |
|
System.Int32 |
userId |
|
Returns
View Source
PerformScheduledPublish(DateTime)
Publishes and unpublishes scheduled documents.
Declaration
IEnumerable<PublishResult> PerformScheduledPublish(DateTime date)
Parameters
Type |
Name |
Description |
DateTime |
date |
|
Returns
View Source
PersistContentSchedule(IContent, ContentScheduleCollection)
Persists publish/unpublish schedule for a content node.
Declaration
void PersistContentSchedule(IContent content, ContentScheduleCollection contentSchedule)
Parameters
View Source
Publish(IContent, String[], Int32)
Declaration
PublishResult Publish(IContent content, string[] cultures, int userId = -1)
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.
|
Returns
View Source
PublishBranch(IContent, Boolean, String[], Int32)
Publishes a document branch.
Declaration
IEnumerable<PublishResult> PublishBranch(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
View Source
RecycleBinSmells()
Returns true if there is any content in the recycle bin
Declaration
Returns
Type |
Description |
System.Boolean |
|
View Source
Rollback(Int32, Int32, String, Int32)
Rolls back the content to a specific version.
Declaration
OperationResult Rollback(int id, int versionId, string culture = "*", int userId = -1)
Parameters
Type |
Name |
Description |
System.Int32 |
id |
The id of the content node.
|
System.Int32 |
versionId |
The version id to roll back to.
|
System.String |
culture |
An optional culture to roll back.
|
System.Int32 |
userId |
The identifier of the user who is performing the roll back.
|
Returns
View Source
Save(IEnumerable<IContent>, Int32)
Declaration
OperationResult Save(IEnumerable<IContent> contents, int userId = -1)
Parameters
Type |
Name |
Description |
IEnumerable<IContent> |
contents |
|
System.Int32 |
userId |
|
Returns
View Source
Save(IContent, Nullable<Int32>, ContentScheduleCollection)
Declaration
OperationResult Save(IContent content, int? userId = null, ContentScheduleCollection contentSchedule = null)
Parameters
Returns
View Source
SaveAndPublish(IContent, String, Int32)
Declaration
PublishResult SaveAndPublish(IContent content, string culture = "*", int userId = -1)
Parameters
Type |
Name |
Description |
IContent |
content |
|
System.String |
culture |
|
System.Int32 |
userId |
|
Returns
View Source
SaveAndPublish(IContent, String[], Int32)
Declaration
PublishResult SaveAndPublish(IContent content, string[] cultures, int userId = -1)
Parameters
Type |
Name |
Description |
IContent |
content |
|
System.String[] |
cultures |
|
System.Int32 |
userId |
|
Returns
View Source
SaveAndPublishBranch(IContent, Boolean, String, Int32)
Declaration
IEnumerable<PublishResult> SaveAndPublishBranch(IContent content, bool force, string culture = "*", int userId = -1)
Parameters
Type |
Name |
Description |
IContent |
content |
|
System.Boolean |
force |
|
System.String |
culture |
|
System.Int32 |
userId |
|
Returns
View Source
SaveAndPublishBranch(IContent, Boolean, String[], Int32)
Declaration
IEnumerable<PublishResult> SaveAndPublishBranch(IContent content, bool force, string[] cultures, int userId = -1)
Parameters
Type |
Name |
Description |
IContent |
content |
|
System.Boolean |
force |
|
System.String[] |
cultures |
|
System.Int32 |
userId |
|
Returns
View Source
SaveBlueprint(IContent, Int32)
Declaration
void SaveBlueprint(IContent content, int userId = -1)
Parameters
Type |
Name |
Description |
IContent |
content |
|
System.Int32 |
userId |
|
View Source
SendToPublication(IContent, Int32)
Saves a document and raises the "sent to publication" events.
Declaration
bool SendToPublication(IContent content, int userId = -1)
Parameters
Type |
Name |
Description |
IContent |
content |
|
System.Int32 |
userId |
|
Returns
Type |
Description |
System.Boolean |
|
View Source
SetPermission(IContent, String, IEnumerable<Int32>)
Assigns a permission to a document.
Declaration
void SetPermission(IContent entity, string permission, IEnumerable<int> groupIds)
Parameters
Type |
Name |
Description |
IContent |
entity |
|
System.String |
permission |
|
IEnumerable<System.Int32> |
groupIds |
|
View Source
SetPermissions(EntityPermissionSet)
Sets the permission of a document.
Declaration
void SetPermissions(EntityPermissionSet permissionSet)
Parameters
View Source
Sort(IEnumerable<IContent>, Int32)
Declaration
OperationResult Sort(IEnumerable<IContent> items, int userId = -1)
Parameters
Type |
Name |
Description |
IEnumerable<IContent> |
items |
|
System.Int32 |
userId |
|
Returns
View Source
Sort(Nullable<IEnumerable<Int32>>, Int32)
Declaration
OperationResult Sort(IEnumerable<int>? ids, int userId = -1)
Parameters
Type |
Name |
Description |
System.Nullable<IEnumerable<System.Int32>> |
ids |
|
System.Int32 |
userId |
|
Returns
View Source
Unpublish(IContent, String, Int32)
Declaration
PublishResult Unpublish(IContent content, string culture = "*", int userId = -1)
Parameters
Type |
Name |
Description |
IContent |
content |
|
System.String |
culture |
|
System.Int32 |
userId |
|
Returns