Interface IContentVersionService
Provides services for managing content versions.
Namespace: Umbraco.Cms.Core.Services
Assembly: Umbraco.Core.dll
Syntax
public interface IContentVersionService
Methods
View SourceGet(int)
Gets the metadata for a specific content version.
Declaration
ContentVersionMeta? Get(int versionId)
Parameters
| Type | Name | Description |
|---|---|---|
| int | versionId | The identifier of the version. |
Returns
| Type | Description |
|---|---|
| ContentVersionMeta | The version metadata, or |
GetAsync(Guid)
Gets a specific content version by its unique identifier.
Declaration
Task<Attempt<IContent?, ContentVersionOperationStatus>> GetAsync(Guid versionId)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | versionId | The unique identifier of the version. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<IContent, ContentVersionOperationStatus>> | An attempt containing the content version or an error status. |
GetPagedContentVersionsAsync(Guid, string?, int, int)
Gets a paged collection of content versions for a content item.
Declaration
Task<Attempt<PagedModel<ContentVersionMeta>?, ContentVersionOperationStatus>> GetPagedContentVersionsAsync(Guid contentId, string? culture, int skip, int take)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | contentId | The unique identifier of the content item. |
| string | culture | The optional culture to filter versions by. |
| int | skip | The number of versions to skip for pagination. |
| int | take | The number of versions to take for pagination. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<PagedModel<ContentVersionMeta>, ContentVersionOperationStatus>> | An attempt containing the paged result or an error status. |
PerformContentVersionCleanup(DateTime)
Removes historic content versions according to a policy.
Declaration
IReadOnlyCollection<ContentVersionMeta> PerformContentVersionCleanup(DateTime asAtDate)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | asAtDate | The date to use when applying cleanup policies. |
Returns
| Type | Description |
|---|---|
| IReadOnlyCollection<ContentVersionMeta> | A collection of version metadata for the versions that were cleaned up. |
RollBackAsync(Guid, string?, Guid)
Rolls back content to a specific version.
Declaration
Task<Attempt<ContentVersionOperationStatus>> RollBackAsync(Guid versionId, string? culture, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | versionId | The unique identifier of the version to roll back to. |
| string | culture | The optional culture to roll back. If |
| Guid | userKey | The unique identifier of the user performing the rollback. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<ContentVersionOperationStatus>> | An attempt containing the operation status. |
SetPreventCleanupAsync(Guid, bool, Guid)
Sets whether a content version should be prevented from automatic cleanup.
Declaration
Task<Attempt<ContentVersionOperationStatus>> SetPreventCleanupAsync(Guid versionId, bool preventCleanup, Guid userKey)
Parameters
| Type | Name | Description |
|---|---|---|
| Guid | versionId | The unique identifier of the version. |
| bool | preventCleanup |
|
| Guid | userKey | The unique identifier of the user performing the action. |
Returns
| Type | Description |
|---|---|
| Task<Attempt<ContentVersionOperationStatus>> | An attempt containing the operation status. |