Interface IContentEditingService
Provides editing services for content items.
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public interface IContentEditingService
Methods
View SourceCopyAsync(Guid, Guid?, bool, bool, Guid)
Copies a content item to a new location.
Declaration
Task<Attempt<IContent?, ContentEditingOperationStatus>> CopyAsync(Guid key, Guid? parentKey, bool relateToOriginal, bool includeDescendants, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the content item to copy. |
| Guid? | parentKey | The unique identifier of the parent for the copy, or |
| bool | relateToOriginal | Whether to create a relation between the copy and the original. |
| bool | includeDescendants | Whether to also copy all descendant content items. |
| Guid | userKey | The unique identifier of the user performing the action. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<IContent, ContentEditingOperationStatus>> | An attempt containing the copied content item or an error status. |
CreateAsync(ContentCreateModel, Guid)
Creates a new content item.
Declaration
Task<Attempt<ContentCreateResult, ContentEditingOperationStatus>> CreateAsync(ContentCreateModel createModel, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| ContentCreateModel | createModel | The model containing the content data. |
| Guid | userKey | The unique identifier of the user performing the action. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<ContentCreateResult, ContentEditingOperationStatus>> | An attempt containing the creation result or an error status. |
DeleteAsync(Guid, Guid)
Deletes a content item whether it is in the recycle bin or not.
Declaration
Task<Attempt<IContent?, ContentEditingOperationStatus>> DeleteAsync(Guid key, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the content item to delete. |
| Guid | userKey | The unique identifier of the user performing the action. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<IContent, ContentEditingOperationStatus>> | An attempt containing the deleted content item or an error status. |
DeleteFromRecycleBinAsync(Guid, Guid)
Deletes a content item if it is in the recycle bin.
Declaration
Task<Attempt<IContent?, ContentEditingOperationStatus>> DeleteFromRecycleBinAsync(Guid key, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the content item to delete. |
| Guid | userKey | The unique identifier of the user performing the action. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<IContent, ContentEditingOperationStatus>> | An attempt containing the deleted content item or an error status. |
GetAsync(Guid)
Gets a content item by its unique identifier.
Declaration
Task<IContent?> GetAsync(Guid key)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the content item. |
Returns
| Type | Description |
|---|---|
| Task<IContent> | The content item, or |
MoveAsync(Guid, Guid?, Guid)
Moves a content item to a new parent.
Declaration
Task<Attempt<IContent?, ContentEditingOperationStatus>> MoveAsync(Guid key, Guid? parentKey, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the content item to move. |
| Guid? | parentKey | The unique identifier of the new parent, or |
| Guid | userKey | The unique identifier of the user performing the action. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<IContent, ContentEditingOperationStatus>> | An attempt containing the moved content item or an error status. |
MoveToRecycleBinAsync(Guid, Guid)
Moves a content item to the recycle bin.
Declaration
Task<Attempt<IContent?, ContentEditingOperationStatus>> MoveToRecycleBinAsync(Guid key, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the content item to move. |
| Guid | userKey | The unique identifier of the user performing the action. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<IContent, ContentEditingOperationStatus>> | An attempt containing the moved content item or an error status. |
RestoreAsync(Guid, Guid?, Guid)
Restores a content item from the recycle bin.
Declaration
Task<Attempt<IContent?, ContentEditingOperationStatus>> RestoreAsync(Guid key, Guid? parentKey, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the content item to restore. |
| Guid? | parentKey | The unique identifier of the parent to restore to, or |
| Guid | userKey | The unique identifier of the user performing the action. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<IContent, ContentEditingOperationStatus>> | An attempt containing the restored content item or an error status. |
SortAsync(Guid?, IEnumerable<SortingModel>, Guid)
Sorts content items under a parent.
Declaration
Task<ContentEditingOperationStatus> SortAsync(Guid? parentKey, IEnumerable<SortingModel> sortingModels, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid? | parentKey | The unique identifier of the parent, or |
| IEnumerable<SortingModel> | sortingModels | The collection of sorting models defining the new order. |
| Guid | userKey | The unique identifier of the user performing the action. |
Returns
| Type | Description |
|---|---|
| Task<ContentEditingOperationStatus> | The operation status indicating success or failure. |
UpdateAsync(Guid, ContentUpdateModel, Guid)
Updates an existing content item.
Declaration
Task<Attempt<ContentUpdateResult, ContentEditingOperationStatus>> UpdateAsync(Guid key, ContentUpdateModel updateModel, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the content item to update. |
| ContentUpdateModel | updateModel | The model containing the updated content data. |
| Guid | userKey | The unique identifier of the user performing the action. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<ContentUpdateResult, ContentEditingOperationStatus>> | An attempt containing the update result or an error status. |
ValidateCreateAsync(ContentCreateModel, Guid)
Validates a content creation model without persisting it.
Declaration
Task<Attempt<ContentValidationResult, ContentEditingOperationStatus>> ValidateCreateAsync(ContentCreateModel createModel, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| ContentCreateModel | createModel | The model containing the content data to validate. |
| Guid | userKey | The unique identifier of the user performing the action. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<ContentValidationResult, ContentEditingOperationStatus>> | An attempt containing the validation result or an error status. |
ValidateUpdateAsync(Guid, ValidateContentUpdateModel, Guid)
Validates a content update model without persisting it.
Declaration
Task<Attempt<ContentValidationResult, ContentEditingOperationStatus>> ValidateUpdateAsync(Guid key, ValidateContentUpdateModel updateModel, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the content item to validate. |
| ValidateContentUpdateModel | updateModel | The model containing the content data to validate. |
| Guid | userKey | The unique identifier of the user performing the action. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<ContentValidationResult, ContentEditingOperationStatus>> | An attempt containing the validation result or an error status. |