Interface IElementEditingService
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public interface IElementEditingService
Methods
View SourceCopyAsync(Guid, Guid?, Guid)
Copies an element to a new location.
Declaration
Task<Attempt<IElement?, ContentEditingOperationStatus>> CopyAsync(Guid key, Guid? containerKey, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the element to copy. |
| Guid? | containerKey | The unique identifier of the container for the copy, or |
| Guid | userKey | The unique identifier of the user performing the action. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<IElement, ContentEditingOperationStatus>> | An attempt containing the copied element or an error status. |
CreateAndPublishAsync(ElementCreateModel, string[], Guid)
Creates and publishes a new element.
Declaration
Task<Attempt<ElementCreateResult, ContentEditingOperationStatus>> CreateAndPublishAsync(ElementCreateModel createModel, string[] culturesToPublish, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| ElementCreateModel | createModel | The model containing the element data. |
| string[] | culturesToPublish | The cultures to publish. |
| Guid | userKey | The unique identifier of the user performing the action. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<ElementCreateResult, ContentEditingOperationStatus>> | An attempt containing the creation result or an error status. |
CreateAsync(ElementCreateModel, Guid)
Creates a new element.
Declaration
Task<Attempt<ElementCreateResult, ContentEditingOperationStatus>> CreateAsync(ElementCreateModel createModel, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| ElementCreateModel | createModel | The model containing the element data. |
| Guid | userKey | The unique identifier of the user performing the action. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<ElementCreateResult, ContentEditingOperationStatus>> | An attempt containing the creation result or an error status. |
DeleteAsync(Guid, Guid)
Deletes an element whether it is in the recycle bin or not.
Declaration
Task<Attempt<IElement?, ContentEditingOperationStatus>> DeleteAsync(Guid key, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the element to delete. |
| Guid | userKey | The unique identifier of the user performing the action. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<IElement, ContentEditingOperationStatus>> | An attempt containing the deleted element or an error status. |
DeleteFromRecycleBinAsync(Guid, Guid)
Deletes an element if it is in the recycle bin.
Declaration
Task<Attempt<IElement?, ContentEditingOperationStatus>> DeleteFromRecycleBinAsync(Guid key, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the element to delete. |
| Guid | userKey | The unique identifier of the user performing the action. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<IElement, ContentEditingOperationStatus>> | An attempt containing the deleted element or an error status. |
GetAsync(Guid)
Gets an element by its unique identifier.
Declaration
Task<IElement?> GetAsync(Guid key)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the element. |
Returns
| Type | Description |
|---|---|
| Task<IElement> | The element, or |
MoveAsync(Guid, Guid?, Guid)
Moves an element to a new container.
Declaration
Task<Attempt<ContentEditingOperationStatus>> MoveAsync(Guid key, Guid? containerKey, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the element to move. |
| Guid? | containerKey | The unique identifier of the new container, or |
| Guid | userKey | The unique identifier of the user performing the action. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<ContentEditingOperationStatus>> | An attempt containing the moved element or an error status. |
MoveToRecycleBinAsync(Guid, Guid)
Moves an element to the recycle bin.
Declaration
Task<Attempt<ContentEditingOperationStatus>> MoveToRecycleBinAsync(Guid key, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the element to move. |
| Guid | userKey | The unique identifier of the user performing the action. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<ContentEditingOperationStatus>> | An attempt containing the moved element or an error status. |
RestoreAsync(Guid, Guid?, Guid)
Restores an element from the recycle bin.
Declaration
Task<Attempt<ContentEditingOperationStatus>> RestoreAsync(Guid key, Guid? containerKey, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the element to restore. |
| Guid? | containerKey | The unique identifier of the container to restore to, or |
| Guid | userKey | The unique identifier of the user performing the action. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<ContentEditingOperationStatus>> | An attempt containing the restored element or an error status. |
UpdateAndPublishAsync(Guid, ElementUpdateModel, string[], Guid)
Updates and publishes an existing element.
Declaration
Task<Attempt<ElementUpdateResult, ContentEditingOperationStatus>> UpdateAndPublishAsync(Guid key, ElementUpdateModel updateModel, string[] culturesToPublish, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the element to update. |
| ElementUpdateModel | updateModel | The model containing the updated element data. |
| string[] | culturesToPublish | The cultures to publish. |
| Guid | userKey | The unique identifier of the user performing the action. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<ElementUpdateResult, ContentEditingOperationStatus>> | An attempt containing the update result or an error status. |
UpdateAsync(Guid, ElementUpdateModel, Guid)
Updates an existing element.
Declaration
Task<Attempt<ElementUpdateResult, ContentEditingOperationStatus>> UpdateAsync(Guid key, ElementUpdateModel updateModel, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the element to update. |
| ElementUpdateModel | updateModel | The model containing the updated element data. |
| Guid | userKey | The unique identifier of the user performing the action. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<ElementUpdateResult, ContentEditingOperationStatus>> | An attempt containing the update result or an error status. |
ValidateCreateAsync(ElementCreateModel, Guid)
Validates an element creation model without persisting it.
Declaration
Task<Attempt<ContentValidationResult, ContentEditingOperationStatus>> ValidateCreateAsync(ElementCreateModel createModel, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| ElementCreateModel | createModel | The model containing the element 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, ValidateElementUpdateModel, Guid)
Validates an element update model without persisting it.
Declaration
Task<Attempt<ContentValidationResult, ContentEditingOperationStatus>> ValidateUpdateAsync(Guid key, ValidateElementUpdateModel updateModel, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | key | The unique identifier of the element to validate. |
| ValidateElementUpdateModel | updateModel | The model containing the element 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. |