Interface IContentFolderManager
- Namespace
- CMS.ContentEngine
- Assembly
- CMS.ContentEngine.dll
Represents a manager for content folders.
public interface IContentFolderManager
- Extension Methods
Methods
Create(int, CreateContentFolderParameters, CancellationToken)
Creates a new content folder under the specified parent folder.
Task<int> Create(int parentFolderId, CreateContentFolderParameters args, CancellationToken cancellationToken = default)
Parameters
parentFolderId
intThe parent folder ID, under which the new folder will be created.
args
CreateContentFolderParametersThe content folder parameters to create the content folder.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<int>
The created content folder ID.
Remarks
The maximum allowed depth of the folder tree is 20.
Exceptions
- ContentFolderNotFoundException
The parent folder does not exist.
- MaxFolderDepthExceededException
The maximum depth of the folder tree is exceeded.
- InvalidOperationException
The folder with the same code name already exists or the folder with the display name already exists under the parent folder.
Delete(int, CancellationToken)
Deletes the content folder with all its children folders. All content items within the affected folders are moved under the root folder.
Task Delete(int folderId, CancellationToken cancellationToken = default)
Parameters
folderId
intThe ID of the folder to delete.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task
Exceptions
- InvalidOperationException
In case the folder to delete is the root folder.
Get()
Gets the object query for ContentFolderInfo retrieval.
ObjectQuery<ContentFolderInfo> Get()
Returns
- ObjectQuery<ContentFolderInfo>
Returns ObjectQuery<TObject> for ContentFolderInfo retrieval.
Get(Guid, CancellationToken)
Gets a content folder by its GUID.
Task<ContentFolderInfo> Get(Guid folderGuid, CancellationToken cancellationToken = default)
Parameters
folderGuid
GuidThe GUID of the content folder.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<ContentFolderInfo>
The ContentFolderInfo or null.
Get(int, CancellationToken)
Gets a content folder by its ID.
Task<ContentFolderInfo> Get(int folderId, CancellationToken cancellationToken = default)
Parameters
folderId
intThe ID of the content folder.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<ContentFolderInfo>
The ContentFolderInfo or null.
Get(string, CancellationToken)
Gets a content folder by its code name.
Task<ContentFolderInfo> Get(string folderName, CancellationToken cancellationToken = default)
Parameters
folderName
stringThe code name of the content folder.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<ContentFolderInfo>
The ContentFolderInfo or null.
GetMetadata(int, CancellationToken)
Gets a content folder metadata by its ID.
Task<ContentFolderMetadata> GetMetadata(int folderId, CancellationToken cancellationToken = default)
Parameters
folderId
intThe ID of the content folder.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<ContentFolderMetadata>
Exceptions
- ContentFolderNotFoundException
The folder does not exist.
GetRoot(string, CancellationToken)
Gets the root content folder of the specified workspace.
Task<ContentFolderInfo> GetRoot(string workspaceName, CancellationToken cancellationToken = default)
Parameters
workspaceName
stringThe code name of the workspace.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<ContentFolderInfo>
The root ContentFolderInfo.
Exceptions
- InvalidOperationException
Thrown when the workspace
workspaceName
is not found.
GetRoot(CancellationToken)
Gets the root content folder.
[Obsolete("Method is deprecated and will be removed in the next version. Use GetRoot(string, CancellationToken) instead.")]
[ObsoleteSince(30, 0)]
Task<ContentFolderInfo> GetRoot(CancellationToken cancellationToken = default)
Parameters
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task<ContentFolderInfo>
The root ContentFolderInfo.
Remarks
Returns root folder of the default migration workspace.
Exceptions
- InvalidOperationException
Thrown when the default workspace is not found.
Move(int, int, CancellationToken)
Moves the content folder to the new parent folder.
Task Move(int folderId, int destinationFolderId, CancellationToken cancellationToken = default)
Parameters
folderId
intThe ID of the folder to move.
destinationFolderId
intThe ID of the destination parent folder.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task
Remarks
The maximum allowed depth of the folder tree is 20.
Exceptions
- ContentFolderNotFoundException
Either the folder or the destination parent folder does not exist.
- MaxFolderDepthExceededException
The maximum depth of the folder tree is exceeded.
- InvalidOperationException
The folder is moved into itself or the folder is moved to its own subfolder.
MoveItems(int, IEnumerable<int>, CancellationToken)
Moves the specified content items to the given content folder.
Task MoveItems(int destFolderId, IEnumerable<int> contentItemIds, CancellationToken cancellationToken = default)
Parameters
destFolderId
intThe ID of the content folder to move the items to.
contentItemIds
IEnumerable<int>The content item IDs to move.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task
Remarks
In case the one of the content items does not exist, it is skipped and the method continues with the next item.
Exceptions
- ArgumentNullException
The
contentItemIds
isnull
.- ContentFolderNotFoundException
The destination folder does not exist.
Update(int, ContentFolderMetadata, CancellationToken)
Updates the specified content folder with the provided metadata.
Task Update(int folderId, ContentFolderMetadata folderMetadata, CancellationToken cancellationToken = default)
Parameters
folderId
intThe ID of the content folder to update.
folderMetadata
ContentFolderMetadataThe updated metadata for the content folder.
cancellationToken
CancellationTokenThe cancellation token.
Returns
- Task
Exceptions
- ContentFolderNotFoundException
The folder does not exist.
- InvalidOperationException
The folder with the same code name already exists or the folder with the display name already exists under the parent folder.