Interface IWebPageManager
Provides management API for typical web page operations.
public interface IWebPageManager
- Extension Methods
Remarks
The interface does not support custom implementation.
Methods
CancelScheduledPublish(int, string, CancellationToken)
Cancels scheduled publish of the web page.
Task CancelScheduledPublish(int webPageItemId, string languageName, CancellationToken cancellationToken = default)
Parameters
webPageItemIdintWeb page identifier.
languageNamestringLanguage codename.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task
Remarks
The method also cancels scheduled unpublish if it was set.
CancelScheduledUnpublish(int, string, CancellationToken)
Cancels scheduled unpublish of the web page.
Task CancelScheduledUnpublish(int webPageItemId, string languageName, CancellationToken cancellationToken = default)
Parameters
webPageItemIdintWeb page identifier.
languageNamestringLanguage codename.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task
Clone(ClonePageParameters, CancellationToken)
Creates a clone of the web page in specified language.
Task<int> Clone(ClonePageParameters parameters, CancellationToken cancellationToken = default)
Parameters
parametersClonePageParametersClone web page parameters.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task<int>
Create(CreateWebPageParameters, CancellationToken)
Create a new web page.
Task<int> Create(CreateWebPageParameters parameters, CancellationToken cancellationToken = default)
Parameters
parametersCreateWebPageParametersCreate web pages parameters.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task<int>
ID of newly created web page.
Remarks
New web page is created as the first child of the parent.
Exceptions
- ArgumentNullException
Thrown when
parametersis null.- InvalidOperationException
Thrown when web page with ID specified in ParentWebPageItemID does not exist. Thrown when content type specified by ContentItemType is not bound to the website channel for which the manager is created. Thrown when content language identified by LanguageName does not exist. Thrown when ScheduledPublishWhen is set and VersionStatus is not InitialDraft. Thrown when ScheduledUnpublishWhen is set without ScheduledPublishWhen and VersionStatus is not Published. Thrown when ScheduledUnpublishWhen is before ScheduledPublishWhen.
- UrlPathCollisionException
Thrown when UrlSlug would be in collision with existing web page.
CreateFolder(CreateFolderParameters, CancellationToken)
Creates a new folder.
Task<int> CreateFolder(CreateFolderParameters parameters, CancellationToken cancellationToken = default)
Parameters
parametersCreateFolderParametersCreate folder parameters.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task<int>
ID of newly created folder.
Exceptions
- ArgumentNullException
Thrown when
parametersis null.- InvalidOperationException
Thrown when web page with ID specified in ParentWebPageItemID does not exists. Thrown when content language identified by LanguageName does not exist.
Delete(DeleteWebPageParameters, CancellationToken)
Deletes a language variant of a web page based on the specified parameters. Deletes all web page data and all child pages in all language variants if the specified language variant is last variant of a web page. If a RedirectToWebPageID is specified, a redirect is created to the target web page after deletion.
Task Delete(DeleteWebPageParameters parameters, CancellationToken cancellationToken = default)
Parameters
parametersDeleteWebPageParametersDelete web page parameters.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task
Exceptions
- ArgumentNullException
Thrown when
parametersis null.- InvalidOperationException
Thrown when web page identified by WebPageItemID is not created in the same website channel for which the manager is created. Thrown when no language identified by LanguageName exists. Thrown when web page identified by RedirectToWebPageID is not a valid candidate for redirect or when it would create an invalid redirect.
Delete(int, string, int, CancellationToken)
Deletes a language variant of a web page. Draft version is deleted as well if exists. Deletes all web page data and all child pages in all language variants if the specified language variant is last variant of a web page.
[Obsolete("Use CMS.Websites.IWebPageManager.Delete(DeleteWebPageParameters, CancellationToken) instead.")]
Task Delete(int webPageItemId, string languageName, int redirectToWebPageId, CancellationToken cancellationToken = default)
Parameters
webPageItemIdintWeb page item identifier.
languageNamestringLanguage codename.
redirectToWebPageIdintIdentifier of the web page that is target of the redirect after the web page is deleted.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task
Exceptions
- InvalidOperationException
Thrown when web page identified by
webPageItemIdis not created in the same website channel for which the manager is created. Thrown when no language identified bylanguageNameexists.
Delete(int, string, CancellationToken)
Deletes a language variant of a web page. Draft version is deleted as well if exists. Deletes all web page data and all child pages in all language variants if the specified language variant is last variant of a web page.
[Obsolete("Use CMS.Websites.IWebPageManager.Delete(DeleteWebPageParameters, CancellationToken) instead.")]
Task Delete(int webPageItemId, string languageName, CancellationToken cancellationToken = default)
Parameters
webPageItemIdintWeb page item identifier.
languageNamestringLanguage codename.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task
Exceptions
- InvalidOperationException
Thrown when web page identified by
webPageItemIdis not created in the same website channel for which the manager is created. Thrown when no language identified bylanguageNameexists.
DestroyChannelWebPages(CancellationToken)
Destroys all web pages on the website channel.
Task DestroyChannelWebPages(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task
Exceptions
- InvalidOperationException
Thrown when the content language dependency of the web page item's cannot be found.
GetContentItemLanguageMetadata(int, string, CancellationToken)
Retrieves language-specific ContentItemLanguageMetadata of an underlying content item of a web page identified by webPageItemId and languageName.
Task<ContentItemLanguageMetadata> GetContentItemLanguageMetadata(int webPageItemId, string languageName, CancellationToken cancellationToken = default)
Parameters
webPageItemIdintWeb page identifier.
languageNamestringLanguage codename.
cancellationTokenCancellationTokenCancellation instruction.
Returns
Exceptions
- ArgumentException
Thrown when the
languageNameis null or empty.- WebPageNotFoundException
Thrown when no web page identified by
webPageItemIdexists.- InvalidOperationException
Thrown when no content item in language variant specified by
languageNameexists as an underlying content item for web page identified bywebPageItemId. Thrown when web page identified bywebPageItemIdis not created in the same website channel for which the manager is created. Thrown when no language identified bylanguageNameexists.
GetWebPageMetadata(int, CancellationToken)
Retrieves WebPageMetadata of a web page identified by webPageItemId.
Task<WebPageMetadata> GetWebPageMetadata(int webPageItemId, CancellationToken cancellationToken = default)
Parameters
webPageItemIdintId of the content item.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task<WebPageMetadata>
Exceptions
- WebPageNotFoundException
Thrown when no web page identified by
webPageItemIdexists.- InvalidOperationException
Thrown when web page identified by
webPageItemIdis not created in the same website channel for which the manager is created.
Move(MoveWebPageParameters, CancellationToken)
Move the web page under a new parent page.
If a parameters.Order.Order is specified, the page is added to the desired position. Otherwise the page is moved as the first child of the parent.
Task Move(MoveWebPageParameters parameters, CancellationToken cancellationToken = default)
Parameters
parametersMoveWebPageParametersMove web page parameters.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task
Exceptions
- WebPageNotFoundException
Thrown when no web page identified by WebPageItemId or TargetParentWebPageItemId exists.
- InvalidOperationException
Thrown when web pages identified by WebPageItemId or by TargetParentWebPageItemId are not created in the same website channel for which the manager is created. Thrown when the ACL for the web page identified by TargetParentWebPageItemId does not exist.
SchedulePublish(int, string, DateTime, CancellationToken)
Schedules publish of the web page.
Task SchedulePublish(int webPageItemId, string languageName, DateTime scheduledTime, CancellationToken cancellationToken = default)
Parameters
webPageItemIdintWeb page identifier.
languageNamestringLanguage codename.
scheduledTimeDateTimeDate and time when the web page should be published.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task
ScheduleUnpublish(int, string, DateTime, int, CancellationToken)
Schedules unpublish of the web page and and sets redirect web page after the web page is unpublished.
Task ScheduleUnpublish(int webPageItemId, string languageName, DateTime scheduledTime, int redirectToWebPageItemId, CancellationToken cancellationToken = default)
Parameters
webPageItemIdintWeb page identifier.
languageNamestringLanguage codename.
scheduledTimeDateTimeDate and time when the web page should be unpublished.
redirectToWebPageItemIdintIdentifier of the web page that is target of the redirect.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task
ScheduleUnpublish(int, string, DateTime, CancellationToken)
Schedules unpublish of the web page.
Task ScheduleUnpublish(int webPageItemId, string languageName, DateTime scheduledTime, CancellationToken cancellationToken = default)
Parameters
webPageItemIdintWeb page identifier.
languageNamestringLanguage codename.
scheduledTimeDateTimeDate and time when the web page should be unpublished.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task
TryArchive(int, string, CancellationToken)
Archives published version of a page.
[Obsolete("Archive status was replaced by Unpublished status, use TryUnpublish instead.")]
Task<bool> TryArchive(int webPageItemId, string languageName, CancellationToken cancellationToken = default)
Parameters
webPageItemIdintWeb page item identifier.
languageNamestringLanguage codename.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task<bool>
True if a published version of the web page was archived, false otherwise.
Exceptions
- WebPageNotFoundException
Thrown when no web page identified by
webPageItemIdandlanguageNameexists.- InvalidOperationException
Thrown when web page identified by
webPageItemIdis folder. Thrown when web page identified bywebPageItemIdis not created in the same website channel for which the manager is created. Thrown when no language identified bylanguageNameexists.
TryCreateDraft(int, string, CancellationToken)
Creates a new draft version for a given web page language variant.
Task<bool> TryCreateDraft(int webPageItemId, string languageName, CancellationToken cancellationToken = default)
Parameters
webPageItemIdintWeb page item identifier.
languageNamestringLanguage codename.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task<bool>
True if a draft version of the web page was created, false otherwise.
Exceptions
- WebPageNotFoundException
Thrown when no web page identified by
webPageItemIdandlanguageNameexists.- InvalidOperationException
Thrown when web page identified by
webPageItemIdis folder. Thrown when web page identified bywebPageItemIdis not created in the same website channel for which the manager is created. Thrown when no language identified bylanguageNameexists.
TryCreateLanguageVariant(CreateLanguageVariantParameters, CancellationToken)
Creates a new language variant of a web page or a folder.
Task<bool> TryCreateLanguageVariant(CreateLanguageVariantParameters parameters, CancellationToken cancellationToken = default)
Parameters
parametersCreateLanguageVariantParametersCreate language variant parameters.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task<bool>
True if a new language variant of the web page was created, false if the web page variant already exists in the target language specified by LanguageName.
Exceptions
- ArgumentNullException
Thrown if
parametersis null.- WebPageNotFoundException
Thrown when no web page identified by WebPageItemID and LanguageName exists.
- InvalidOperationException
Thrown when web page identified by WebPageItemID is not created in the same website channel for which the manager is created. Thrown when content language identified by LanguageName does not exist. Thrown when ScheduledPublishWhen is set and VersionStatus is not InitialDraft. Thrown when ScheduledUnpublishWhen is set without ScheduledPublishWhen and VersionStatus is not Published. Thrown when ScheduledUnpublishWhen is before ScheduledPublishWhen.
- UrlPathCollisionException
Thrown when UrlSlug would be in collision with existing web page.
TryDiscardDraft(int, string, CancellationToken)
Discards draft version of a given web page language variant.
Task<bool> TryDiscardDraft(int webPageItemId, string languageName, CancellationToken cancellationToken = default)
Parameters
webPageItemIdintWeb page item identifier.
languageNamestringLanguage codename.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task<bool>
True if a draft version of the web page was discarded, false otherwise.
Remarks
InitialDraft of a web page cannot be discarded. Use Delete(DeleteWebPageParameters, CancellationToken) if you want to remove the initial draft.
Exceptions
- WebPageNotFoundException
Thrown when no web page identified by
webPageItemIdandlanguageNameexists.- InvalidOperationException
Thrown when web page identified by
webPageItemIdis folder. Thrown when web page identified bywebPageItemIdis not created in the same website channel for which the manager is created. Thrown when no language identified bylanguageNameexists.
TryPublish(int, string, CancellationToken)
Publishes draft version of a page.
Task<bool> TryPublish(int webPageItemId, string languageName, CancellationToken cancellationToken = default)
Parameters
webPageItemIdintWeb page item identifier.
languageNamestringLanguage codename.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task<bool>
True if a draft version of the web page was published, false otherwise.
Exceptions
- WebPageNotFoundException
Thrown when no web page identified by
webPageItemIdandlanguageNameexists.- UrlPathCollisionException
Thrown when the new web page URL path conflicts with the URL path of another web page.
- InvalidOperationException
Thrown when web page identified by
webPageItemIdis folder. Thrown when web page identified bywebPageItemIdis not created in the same website channel for which the manager is created. Thrown when no language identified bylanguageNameexists.
TryUnpublish(int, string, int, CancellationToken)
Unpublishes published version of a page and sets a redirect for the unpublished web page.
Task<bool> TryUnpublish(int webPageItemId, string languageName, int redirectToWebPageItemId, CancellationToken cancellationToken = default)
Parameters
webPageItemIdintWeb page item identifier.
languageNamestringLanguage codename.
redirectToWebPageItemIdintWeb page item identifier where to redirect the web page after unpublish.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task<bool>
True if a published version of the web page was unpublished, false otherwise.
Exceptions
- WebPageNotFoundException
Thrown when no web page identified by
webPageItemIdandlanguageNameexists.- InvalidOperationException
Thrown when web page identified by
webPageItemIdis folder. Thrown when web page identified bywebPageItemIdis not created in the same website channel for which the manager is created. Thrown when no language identified bylanguageNameexists. Thrown whenredirectToWebPageItemIdis same aswebPageItemId.
TryUnpublish(int, string, CancellationToken)
Unpublishes published version of a page.
Task<bool> TryUnpublish(int webPageItemId, string languageName, CancellationToken cancellationToken = default)
Parameters
webPageItemIdintWeb page item identifier.
languageNamestringLanguage codename.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task<bool>
True if a published version of the web page was unpublished, false otherwise.
Exceptions
- WebPageNotFoundException
Thrown when no web page identified by
webPageItemIdandlanguageNameexists.- InvalidOperationException
Thrown when web page identified by
webPageItemIdis folder. Thrown when web page identified bywebPageItemIdis not created in the same website channel for which the manager is created. Thrown when no language identified bylanguageNameexists.
TryUpdateDraft(int, string, UpdateDraftData, CancellationToken)
Updates draft version data.
Task<bool> TryUpdateDraft(int webPageItemId, string languageName, UpdateDraftData updateDraftData, CancellationToken cancellationToken = default)
Parameters
webPageItemIdintWeb page item identifier.
languageNamestringLanguage codename.
updateDraftDataUpdateDraftDataUpdate draft data.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task<bool>
True if a draft version was updated, false otherwise.
Exceptions
- WebPageNotFoundException
Thrown when no web page identified by
webPageItemIdandlanguageNameexists.- UrlPathCollisionException
Thrown when the new web page URL path conflicts with the URL path of another web page.
- ArgumentNullException
Thrown when
updateDraftDatais null.- InvalidOperationException
Thrown when web page identified by
webPageItemIdis folder. Thrown when web page identified bywebPageItemIdis not created in the same website channel for which the manager is created. Thrown when no language identified bylanguageNameexists.
UpdateLanguageMetadata(ContentItemLanguageMetadata, CancellationToken)
Updates the content item language data, allowing a new value to be set in the ContentItemLanguageMetadata object.
Task UpdateLanguageMetadata(ContentItemLanguageMetadata contentItemLanguageMetadata, CancellationToken cancellationToken = default)
Parameters
contentItemLanguageMetadataContentItemLanguageMetadataContent item language metadata with updated values.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task
Exceptions
- ArgumentNullException
Thrown if
contentItemLanguageMetadatais null.- ContentItemNotFoundException
Thrown when no content item with the identifier specified in ContentItemID and LanguageName exists.
- InvalidOperationException
Thrown when content language identified by LanguageName does not exist. Thrown when ScheduledPublishWhen is set and LatestVersionStatus is not InitialDraft or Draft. Thrown when ScheduledUnpublishWhen is set without ScheduledPublishWhen and LatestVersionStatus is not Published. Thrown when ScheduledUnpublishWhen is before ScheduledPublishWhen. Thrown when ScheduledPublishWhen or ScheduledUnpublishWhen is set and content item identified by ContentItemID is folder.
UpdateMetadata(WebPageMetadata, CancellationToken)
Updates the web page data, allowing a new value to be set in the WebPageMetadata object.
Task UpdateMetadata(WebPageMetadata webPageMetadata, CancellationToken cancellationToken = default)
Parameters
webPageMetadataWebPageMetadataWeb page metadata with updated values.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task
Exceptions
- ArgumentNullException
Thrown if
webPageMetadatais null.- WebPageNotFoundException
Thrown when no web page with the identifier specified by WebPageID exists.
- CodeNameNotValidException
Thrown when Name is not in valid format. The code name can contain only alphanumeric characters, some special characters (_, -, .) and cannot start or end with '.'.
- CodeNameNotUniqueException
Thrown when Name is not globally unique code name.
- InvalidOperationException
Thrown when web page identified by WebPageID is not created in the same website channel for which the manager is created.
UpdateSecuritySettings(int, bool, CancellationToken)
Update security setting for the web page.
Task UpdateSecuritySettings(int webPageItemId, bool isSecured, CancellationToken cancellationToken = default)
Parameters
webPageItemIdintWeb page item identifier.
isSecuredboolSecurity setting.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task
Exceptions
- WebPageNotFoundException
Thrown when no web page identified by
webPageItemIdexists.- InvalidOperationException
Thrown when web page identified by
webPageItemIdis not created in the same website channel for which the manager is created.
UpdateTreePathSlug(int, string, CancellationToken)
Updates tree path of a web page. New tree path value must be unique.
Task<bool> UpdateTreePathSlug(int webPageItemId, string treePathSlug, CancellationToken cancellationToken = default)
Parameters
webPageItemIdintWeb page identifier.
treePathSlugstringNew tree path slug.
cancellationTokenCancellationTokenCancellation instruction.
Returns
- Task<bool>
True if a new tree path value was unique and tree path was updated, false otherwise.
Remarks
Tree path of all child web pages is updated as well.
Exceptions
- WebPageNotFoundException
Thrown when no web page with the identifier specified in
webPageItemIdexists.- ArgumentException
Thrown when
treePathSlugis not in valid format. The slug can contain only alphanumeric characters, some special characters (_, -, .) and cannot start or end with '.' Maximum length of a tree path slug is 50 characters.- InvalidOperationException
Thrown when web page identified by
webPageItemIdis not created in the same website channel for which the manager is created.