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, Int32, Boolean, Boolean, Int32)
Copies a document.
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
Type | Description |
---|---|
IContent |
Remarks
Optionally recursively copies all children.
Copy(IContent, Int32, Boolean, Int32)
Copies a document.
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
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 |
---|---|---|
System.String | documentTypeAlias |
Returns
Type | Description |
---|---|
System.Int32 |
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 |
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 |
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 |
Create(String, Guid, String, Int32)
Creates a document.
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
Type | Description |
---|---|
IContent |
Create(String, Int32, String, Int32)
Creates a document.
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
Type | Description |
---|---|
IContent |
Create(String, Int32, IContentType, Int32)
Creates a document
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
Type | Description |
---|---|
IContent |
Create(String, IContent, String, Int32)
Creates a document.
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
Type | Description |
---|---|
IContent |
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
Type | Description |
---|---|
IContent |
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
Type | Description |
---|---|
IContent |
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
Type | Description |
---|---|
IContent |
Delete(IContent, Int32)
Deletes a document.
Declaration
OperationResult Delete(IContent content, int userId = -1)
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.
DeleteBlueprint(IContent, Int32)
Deletes a blueprint.
Declaration
void DeleteBlueprint(IContent content, int userId = -1)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | |
System.Int32 | userId |
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 |
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 |
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 |
Remarks
All non-deleted descendants of the deleted documents are moved to the recycle bin.
This operation is potentially dangerous and expensive.
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 |
Remarks
All non-deleted descendants of the deleted documents are moved to the recycle bin.
This operation is potentially dangerous and expensive.
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 |
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 |
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
Type | Description |
---|---|
OperationResult |
GetAncestors(Int32)
Gets ancestor documents of a document.
Declaration
IEnumerable<IContent> GetAncestors(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | 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(Int32)
Gets a blueprint.
Declaration
IContent GetBlueprintById(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id |
Returns
Type | Description |
---|---|
IContent |
GetBlueprintsForContentTypes(Int32[])
Gets blueprints for a content type.
Declaration
IEnumerable<IContent> GetBlueprintsForContentTypes(params int[] documentTypeId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32[] | 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(Int32)
Gets a document.
Declaration
IContent GetById(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | 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<Int32>)
Gets documents.
Declaration
IEnumerable<IContent> GetByIds(IEnumerable<int> ids)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<System.Int32> | ids |
Returns
Type | Description |
---|---|
IEnumerable<IContent> |
GetByLevel(Int32)
Gets documents at a given level.
Declaration
IEnumerable<IContent> GetByLevel(int level)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | 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(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
Type | Description |
---|---|
ContentScheduleCollection | ContentScheduleCollection |
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
Type | Description |
---|---|
IEnumerable<IContent> |
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
Type | Description |
---|---|
IEnumerable<IContent> |
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
Type | Description |
---|---|
IEnumerable<IContent> |
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
Type | Description |
---|---|
IEnumerable<IContent> |
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
Type | Description |
---|---|
IEnumerable<IContent> |
GetParent(Int32)
Gets the parent of a document.
Declaration
IContent GetParent(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | 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(Int32)
Gets a version of a document.
Declaration
IContent GetVersion(int versionId)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | versionId |
Returns
Type | Description |
---|---|
IContent |
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> |
Remarks
Versions are ordered with current first, then most recent first.
GetVersions(Int32)
Gets all versions of a document.
Declaration
IEnumerable<IContent> GetVersions(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id |
Returns
Type | Description |
---|---|
IEnumerable<IContent> |
Remarks
Versions are ordered with current first, then most recent first.
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
Type | Description |
---|---|
IEnumerable<IContent> |
Remarks
Versions are ordered with current first, then most recent first.
HasChildren(Int32)
Gets a value indicating whether a document has children.
Declaration
bool HasChildren(int id)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | id |
Returns
Type | Description |
---|---|
System.Boolean |
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 |
---|---|
System.Boolean |
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 |
---|---|
System.Boolean |
Remarks
A document is path-published when all its ancestors, and the document itself, are published.
Move(IContent, Int32, Int32)
Moves a document under a new parent.
Declaration
void Move(IContent content, int parentId, int userId = -1)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | |
System.Int32 | parentId | |
System.Int32 | userId |
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
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 |
RecycleBinSmells()
Returns true if there is any content in the recycle bin
Declaration
bool RecycleBinSmells()
Returns
Type | Description |
---|---|
System.Boolean |
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
Type | Description |
---|---|
OperationResult |
Remarks
When no culture is specified, all cultures are rolled back.
Save(IEnumerable<IContent>, Int32)
Saves documents.
Declaration
OperationResult Save(IEnumerable<IContent> contents, int userId = -1)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IContent> | contents | |
System.Int32 | userId |
Returns
Type | Description |
---|---|
OperationResult |
Save(IContent, Nullable<Int32>, ContentScheduleCollection)
Saves a document.
Declaration
OperationResult Save(IContent content, int? userId = null, ContentScheduleCollection contentSchedule = null)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | |
System.Nullable<System.Int32> | userId | |
ContentScheduleCollection | contentSchedule |
Returns
Type | Description |
---|---|
OperationResult |
SaveAndPublish(IContent, String, Int32)
Saves and publishes a document.
Declaration
PublishResult SaveAndPublish(IContent content, string culture = "*", int userId = -1)
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. |
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.
SaveAndPublish(IContent, String[], Int32)
Saves and publishes a document.
Declaration
PublishResult SaveAndPublish(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
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.
SaveAndPublishBranch(IContent, Boolean, String, Int32)
Saves and publishes a document branch.
Declaration
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 |
---|---|
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
.
SaveAndPublishBranch(IContent, Boolean, String[], Int32)
Saves and publishes a document branch.
Declaration
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 |
---|---|
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
.
SaveBlueprint(IContent, Int32)
Saves a blueprint.
Declaration
void SaveBlueprint(IContent content, int userId = -1)
Parameters
Type | Name | Description |
---|---|---|
IContent | content | |
System.Int32 | userId |
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 |
SetPermission(IContent, Char, IEnumerable<Int32>)
Assigns a permission to a document.
Declaration
void SetPermission(IContent entity, char permission, IEnumerable<int> groupIds)
Parameters
Type | Name | Description |
---|---|---|
IContent | entity | |
System.Char | permission | |
IEnumerable<System.Int32> | 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<IContent>, Int32)
Sorts documents.
Declaration
OperationResult Sort(IEnumerable<IContent> items, int userId = -1)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IContent> | items | |
System.Int32 | userId |
Returns
Type | Description |
---|---|
OperationResult |
Sort(Nullable<IEnumerable<Int32>>, Int32)
Sorts documents.
Declaration
OperationResult Sort(IEnumerable<int>? ids, int userId = -1)
Parameters
Type | Name | Description |
---|---|---|
System.Nullable<IEnumerable<System.Int32>> | ids | |
System.Int32 | userId |
Returns
Type | Description |
---|---|
OperationResult |
Unpublish(IContent, String, Int32)
Unpublishes a document.
Declaration
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.