November Happy Hour will be moved to Thursday December 5th.

Class DataFactory

Master data source in EPiServer CMS. It's the default implementation of the IContentRepository interface, as well as several other page related interfaces.

Inheritance
System.Object
DataFactory
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer
Assembly: EPiServer.dll
Version: 8.11.0
Syntax
[ServiceConfiguration(ServiceType = typeof(IPageSource), FactoryMember = "Instance", Lifecycle = ServiceInstanceScope.Singleton)]
[ServiceConfiguration(ServiceType = typeof(IContentSource), FactoryMember = "Instance", Lifecycle = ServiceInstanceScope.Singleton)]
[ServiceConfiguration(ServiceType = typeof(IPageStatistics), FactoryMember = "Instance", Lifecycle = ServiceInstanceScope.Singleton)]
[ServiceConfiguration(ServiceType = typeof(IEnterpriseSettings), FactoryMember = "Instance", Lifecycle = ServiceInstanceScope.Singleton)]
public class DataFactory : PageStoreBase, IContentEvents, IDisposable, IPageCriteriaQueryService, IPageSource, IContentSource, IPageStatistics, IContentVersionRepository, IContentProviderManager, IEnterpriseSettings, IContentModelUsage, IContentRepository, IContentLoader, IContentSecurityRepository
Remarks

DataFactory is responsible for all page-related activities, including loading, saving, deleting, caching, moving, etc. The class also has events, which you can use to extend the functionality of EPiServer. For example, if you want to send an e-mail whenever a page is published, use one of the PublishingPage or PublishedPage events exposed by DataFactory. You can even cancel events, adding another level of authorization.

DataFactory has full support for redirecting a request to a remote EPiServer site, the ProviderName property on ContentReference specifies the short name for the remote site to operate against. This site must be configured in Admin mode prior to usage.

You can also monitor how the page cache performs by checking the different hit counters, like PageFetchDatabaseReads, ListingFetchDatabaseReads, PageFetchCacheHits etc.

note

You can access the DataFactory either through the static property EPiServer.DataFactory.Instance, or you can have it injected from the IOC container. If you are using the dependancy injection way, make sure to always work with the interfaces.

Do not instantiate your own DataFactory classes if you are not certain that you have to. A DataFactory object not created by EPiServer will not use the cache, and the performance will be significantly lower.

Examples

This following code example shows how to use the global DataFactory instance to fetch a page with a given ID.

The following code example demonstrates the usage of DataFactory to delete a page.

The following example shows how to use the global DataFactory instance to fetch a page with a given ID on a remote server. You must configure the site in Admin mode under "Remote sites".

The following code sample demonstrates how you can create a new page of your specific PageData type.

The following code example demonstrates how to use the built-in statistics properties.

Constructors

DataFactory()

Default constructor for creating a DataFactory.

Declaration
public DataFactory()
Remarks

Explicitly creating instances of Datafactory is only meant for test scenarios. During runtime Instance should be used.

DataFactory(EPiServerCompatibility)

Initializes a new instance of the DataFactory class.

Declaration
public DataFactory(EPiServerCompatibility compatibility)
Parameters
Type Name Description
EPiServerCompatibility compatibility

The compatibility.

Remarks

Explicitly creating instances of Datafactory is only meant for test scenarios. During runtime Instance should be used.

DataFactory(ContentProviderMap, IPermanentLinkMapper)

Initializes a new instance of the DataFactory class.

Declaration
public DataFactory(ContentProviderMap providerMap, IPermanentLinkMapper mapper)
Parameters
Type Name Description
ContentProviderMap providerMap

The provider map.

IPermanentLinkMapper mapper

The permanent link mapper.

Remarks

When creating a datafactory using this constructor you need to initialize it calling Initialize(EPiServerSection).

Explicitly creating instances of Datafactory is only meant for test scenarios. During runtime Instance should be used.

Properties

CurrentPage

Get data for the current page.

Declaration
public PageData CurrentPage { get; }
Property Value
Type Description
PageData

The PageData object.

Remarks

This IPageSource implementation simply returns null since DataFactory has no concept of a "current" page.

Instance

Gets the global instance of data factory

Declaration
public static DataFactory Instance { get; }
Property Value
Type Description
DataFactory

ListingFetchCacheHits

Total count of page children fetches on all PageProviders only for cached pages

Declaration
public int ListingFetchCacheHits { get; }
Property Value
Type Description
System.Int32

ListingFetchCount

Total count of page children fetches on all PageProviders included cached pages

Declaration
public int ListingFetchCount { get; }
Property Value
Type Description
System.Int32

ListingFetchDatabaseReads

Total count of page children fetches on all PageProviders without cached pages

Declaration
public int ListingFetchDatabaseReads { get; }
Property Value
Type Description
System.Int32

PageFetchCacheHits

Total count of Page fetches on all PageProviders only for cached pages

Declaration
public int PageFetchCacheHits { get; }
Property Value
Type Description
System.Int32

PageFetchCount

Total count of Page fetches on all PageProviders included cached pages

Declaration
public int PageFetchCount { get; }
Property Value
Type Description
System.Int32

PageFetchDatabaseReads

Total count of Page fetches on all PageProviders without cached pages

Declaration
public int PageFetchDatabaseReads { get; }
Property Value
Type Description
System.Int32

PermanentLinkMapper

Gets the permanent link mapper.

Declaration
public IPermanentLinkMapper PermanentLinkMapper { get; set; }
Property Value
Type Description
IPermanentLinkMapper

The permanent link mapper.

ProviderMap

Gets the mapping of Content providers.

Declaration
public ContentProviderMap ProviderMap { get; }
Property Value
Type Description
ContentProviderMap

The provider map.

Remarks

The Provider map contains mapping of the remote site information to IPageStore implementations.

Methods

Copy(ContentReference, ContentReference, AccessLevel, AccessLevel, Boolean)

Creates a copy of a content and it's eventual children and adds the new content(s) under the specicalized destination first ensuring that the current user meets the minimal access right requirements.

Declaration
public ContentReference Copy(ContentReference contentLink, ContentReference destinationLink, AccessLevel requiredSourceAccess, AccessLevel requiredDestinationAccess, bool publishOnDestination)
Parameters
Type Name Description
ContentReference contentLink

The content link.

ContentReference destinationLink

The destination where the content will be copied as a child to.

AccessLevel requiredSourceAccess

The access rights required on the source content that is to be copied.

AccessLevel requiredDestinationAccess

The access rights required on the destination content.

System.Boolean publishOnDestination

If the new content(s) should be published on the destination.

Returns
Type Description
ContentReference

A reference to the new copy of the conent.

Remarks

If publishOnDestination is true the new content will be published immediately at the destination.

Copy(PageReference, PageReference)

Copy a page to another container.

Declaration
public PageReference Copy(PageReference pageLink, PageReference destinationLink)
Parameters
Type Name Description
PageReference pageLink

The link to the page to copy.

PageReference destinationLink

The container where the page will be copied

Returns
Type Description
PageReference
Remarks

Note, when a page is copied successfully the CreatedPage event is fired, since a page is created in the copy process. But in contrast to the Save method, that also fires the CreatedPage method and always passes an initialized PageData object in the PageEventArgs object to the event handler, the Copy method does not. Instead it only passes a pagereference to the copied page and it is up to the handler to load the page data. The reason for this behavior in the Copy method is performance.

Exceptions
Type Condition
AccessDeniedException

Thrown AccessDeniedException when user doesnt have enough access right to perform this action

Copy(PageReference, PageReference, AccessLevel, AccessLevel, Boolean, Boolean)

Creates a copy of a page and it's eventual children and adds the new page(s) under the specicalized destination page first ensuring that the current user meets the minimal access right requirements.

Declaration
public PageReference Copy(PageReference pageLink, PageReference destinationLink, AccessLevel requiredSourceAccess, AccessLevel requiredDestinationAccess, bool publishOnDestination, bool allowThreading)
Parameters
Type Name Description
PageReference pageLink

The page that should be copied.

PageReference destinationLink

The destination page where the page will be copied as a child to.

AccessLevel requiredSourceAccess

The access rights required on the source page that is to be copied.

AccessLevel requiredDestinationAccess

The access rights required on the destination page.

System.Boolean publishOnDestination

If the new page(s) should be published on the destination.

System.Boolean allowThreading

Run the local copy process on a separate thread (doesn't work for remote sites).

Returns
Type Description
PageReference

A reference to the new copy of the page.

Remarks

If publishOnDestination is true the new page will be published immediately at the destination.

Copy(PageReference, PageReference, Boolean)

Copy a page to another container.

Declaration
[Obsolete("Use overload without allowThreading")]
public PageReference Copy(PageReference pageLink, PageReference destinationLink, bool allowThreading)
Parameters
Type Name Description
PageReference pageLink

The link to the page to copy.

PageReference destinationLink

The container where the page will be copied

System.Boolean allowThreading

Run the local copy process on a separate thread (don't work for remote sites).

Returns
Type Description
PageReference
Remarks

Note, when a page is copied successfully the CreatedPage event is fired, since a page is created in the copy process. But in contrast to the Save method, that also fires the CreatedPage method and always passes an initialized PageData object in the PageEventArgs object to the event handler, the Copy method does not. Instead it only passes a pagereference to the copied page and it is up to the handler to load the page data. The reason for this behavior in the Copy method is performance.

Exceptions
Type Condition
AccessDeniedException

Thrown AccessDeniedException when user doesnt have enough access right to perform this action

Copy(PageReference, PageReference, Boolean, Boolean)

Copy a page to another container.

Declaration
public PageReference Copy(PageReference pageLink, PageReference destinationLink, bool publishOnDestination, bool allowThreading)
Parameters
Type Name Description
PageReference pageLink

The link to the page to copy.

PageReference destinationLink

The container where the page will be copied

System.Boolean publishOnDestination

If the new pages should be published on the destination

System.Boolean allowThreading

Run the local copy process on a separate thread (don't work for remote sites).

Returns
Type Description
PageReference
Remarks

Access right required:

Note, when a page is copied successfully the <xref href="EPiServer.Core.PageStoreBase.CreatedPage" data-throw-if-not-resolved="false"></xref> event is fired,
since a page is created in the copy process. But in contrast to the Save method, that also
fires the CreatedPage method and always passes an initialized PageData object in the 

PageEventArgs object to the event handler, the Copy method does not. Instead it only passes a pagereference to the copied page and it is up to the handler to load the page data. The reason for this behavior in the Copy method is performance.

Exceptions
Type Condition
AccessDeniedException

Thrown AccessDeniedException when user doesnt have enough access right to perform this action

CreateLanguageBranch(PageReference, ILanguageSelector)

Create a page language in database.

Declaration
public PageData CreateLanguageBranch(PageReference pageLink, ILanguageSelector selector)
Parameters
Type Name Description
PageReference pageLink

The link to the page to create a language branch for.

ILanguageSelector selector

The language to create.

Returns
Type Description
PageData

A PageData object with the newly created page data.

Remarks

Access right required AccessLevel.Edit

CreateLanguageBranch(PageReference, ILanguageSelector, AccessLevel)

Creates a new language branch for a page in the specified language first ensuring that the current user meets the minimal access right requirements.

Declaration
[Obsolete("Use CreateLanguageBranch<T>(ContentReference contentLink, CultureInfo language)")]
public PageData CreateLanguageBranch(PageReference pageLink, ILanguageSelector selector, AccessLevel access)
Parameters
Type Name Description
PageReference pageLink

The link to the page to create a language branch for.

ILanguageSelector selector

A selector that specifies what language to create the branch for.

AccessLevel access

The required access level that the current user must have to be allowed to create a language branch.

Returns
Type Description
PageData

A PageData object for the newly created page in the specified language.

Exceptions
Type Condition
AccessDeniedException

Thrown AccessDeniedException when user does not have access right to perform this action

System.ArgumentNullException

Thrown when the pageLink is NOT vaild

CreateLanguageBranch<T>(ContentReference, CultureInfo)

Creates a new language branch for a content item in the specified language first ensuring that the current user meets the minimal access right requirements.

Declaration
public T CreateLanguageBranch<T>(ContentReference contentLink, CultureInfo language)

    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

The link to the content to create a language branch for.

System.Globalization.CultureInfo language

The language.

Returns
Type Description
T

An IContentData object for the newly created content in the specified language.

Type Parameters
Name Description
T

The type of content to create.

Remarks

Access checks are performed during Save. CreateLanguageBranch method returns not persisted in-memory instance.

Delete(ContentReference, Boolean, AccessLevel)

Deletes a page from the repository first ensuring that the current user meets the minimal access right requirements.

Declaration
public void Delete(ContentReference contentLink, bool forceDelete, AccessLevel access)
Parameters
Type Name Description
ContentReference contentLink

The link to the page that should be be deleted.

System.Boolean forceDelete

If set to true, deletes the page even if it is being referenced by other pages.

AccessLevel access

The required access level that the current user must have to be allowed to delete the page.

Exceptions
Type Condition
AccessDeniedException

Thrown AccessDeniedException when user doesnt have access right to perform this action

System.ArgumentNullException

Thrown when the pageLink is NOT vaild

EPiServerCancelException

Thrown when the DeletingEvent be canceled

Delete(PageReference, Boolean)

Delete a page

Declaration
public void Delete(PageReference pageLink, bool forceDelete)
Parameters
Type Name Description
PageReference pageLink

The link to the page which will be deleted

System.Boolean forceDelete

Delete page even if being linked by other pages

Remarks

Access right required AccessLevel.Delete

Exceptions
Type Condition
AccessDeniedException

Thrown AccessDeniedException when user doesnt have access right to perform this action

Delete(PageReference, Boolean, AccessLevel)

Deletes a page from the repository first ensuring that the current user meets the minimal access right requirements.

Declaration
public void Delete(PageReference pageLink, bool forceDelete, AccessLevel access)
Parameters
Type Name Description
PageReference pageLink

The link to the page that should be be deleted.

System.Boolean forceDelete

If set to true, deletes the page even if it is being referenced by other pages.

AccessLevel access

The required access level that the current user must have to be allowed to delete the page.

DeleteChildren(ContentReference, Boolean, AccessLevel)

Deletes all the children of a page from the repository first ensuring that the current user meets the minimal access right requirements.

Declaration
public void DeleteChildren(ContentReference contentLink, bool forceDelete, AccessLevel access)
Parameters
Type Name Description
ContentReference contentLink

The page whose children will be deleted.

System.Boolean forceDelete

If set to true, deletes child pages even if they are being referenced by other pages.

AccessLevel access

The required access level that the current user must have to be allowed to delete the child page.

Exceptions
Type Condition
AccessDeniedException

Thrown AccessDeniedException when user does not have access right to perform this action

System.ArgumentNullException

Thrown when the pageLink is NOT vaild

DeleteChildren(PageReference, Boolean)

Delete children of a page.

Declaration
public void DeleteChildren(PageReference pageLink, bool forceDelete)
Parameters
Type Name Description
PageReference pageLink

The children of this page will be deleted.

System.Boolean forceDelete

Delete page even if referenced by other pages.

Remarks

Access right required AccessLevel.Delete

Exceptions
Type Condition
AccessDeniedException

Thrown AccessDeniedException when user does not have access right to perform this action

DeleteChildren(PageReference, Boolean, AccessLevel)

Deletes all the children of a page from the repository first ensuring that the current user meets the minimal access right requirements.

Declaration
public void DeleteChildren(PageReference pageLink, bool forceDelete, AccessLevel access)
Parameters
Type Name Description
PageReference pageLink

The page whose children will be deleted.

System.Boolean forceDelete

If set to true, deletes child pages even if they are being referenced by other pages.

AccessLevel access

The required access level that the current user must have to be allowed to delete the child page.

DeleteLanguageBranch(ContentReference, String, AccessLevel)

Deletes the specified language branch for a page from the repository first ensuring that the current user meets the minimal access right requirements.

Declaration
public void DeleteLanguageBranch(ContentReference contentLink, string languageBranch, AccessLevel access)
Parameters
Type Name Description
ContentReference contentLink

The link to the page which will be deleted.

System.String languageBranch

The language branch to delete.

AccessLevel access

The required access level that the current user must have on the page to be allowed to delete the language branch.

Remarks

You cannot delete the master language branch

Exceptions
Type Condition
AccessDeniedException

Thrown AccessDeniedException when user doesnt have access right to perform this action

System.ArgumentNullException

Thrown when the pageLink is NOT vaild

EPiServerCancelException

Thrown when the DeletingPageLanguageEvent be canceled

DeleteLanguageBranch(PageReference, String)

Delete a page language

Declaration
public void DeleteLanguageBranch(PageReference pageLink, string languageBranch)
Parameters
Type Name Description
PageReference pageLink

The link to the page which will be deleted

System.String languageBranch

The language branch to delete

Remarks

You cannot delete the master language branch

Access right required AccessLevel.Delete

Exceptions
Type Condition
AccessDeniedException

Thrown AccessDeniedException when user doesnt have enough access right to perform this action

DeleteLanguageBranch(PageReference, String, AccessLevel)

Deletes the specified language branch for a page from the repository first ensuring that the current user meets the minimal access right requirements.

Declaration
public void DeleteLanguageBranch(PageReference pageLink, string languageBranch, AccessLevel access)
Parameters
Type Name Description
PageReference pageLink

The link to the page which will be deleted.

System.String languageBranch

The language branch to delete.

AccessLevel access

The required access level that the current user must have on the page to be allowed to delete the language branch.

DeleteVersion(ContentReference, AccessLevel)

Delete a single version of a page

Declaration
public void DeleteVersion(ContentReference contentLink, AccessLevel access)
Parameters
Type Name Description
ContentReference contentLink

Link to the page and version which will be deleted

AccessLevel access

The required access level to perform this operation

Remarks

The published version of page cannot be deleted

Exceptions
Type Condition
AccessDeniedException

Thrown AccessDeniedException when user does not have access right to perform this action

System.ArgumentNullException

Thrown when the pageLink is NOT vaild

DeleteVersion(PageReference)

Delete a single version of a page

Declaration
public void DeleteVersion(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

Link to the page and version which will be deleted

Remarks

The published version of page cannot be deleted

Access right required AccessLevel.Delete

Exceptions
Type Condition
AccessDeniedException

Thrown AccessDeniedException when user does not have access right to perform this action

FindAllPagesWithCriteria(PageReference, PropertyCriteriaCollection, String, ILanguageSelector)

Search for pages that fulfil specific criteria. Will not filter on access.

Declaration
public PageDataCollection FindAllPagesWithCriteria(PageReference pageLink, PropertyCriteriaCollection criterias, string languageBranch, ILanguageSelector selector)
Parameters
Type Name Description
PageReference pageLink

The root page for which the search will be performed

PropertyCriteriaCollection criterias

The criterias for pages

System.String languageBranch

Only search for pages on specific language branch

ILanguageSelector selector

A language selector used to determine the language of pages to return

Returns
Type Description
PageDataCollection

A collection of pages that fulfil the criteras, will be empty if no match is found.

Exceptions
Type Condition
System.ArgumentNullException

Thrown when the pageLink is NOT vaild

FindPagesWithCriteria(PageReference, PropertyCriteriaCollection)

Search for pages that fulfil a specific criterias

Declaration
public PageDataCollection FindPagesWithCriteria(PageReference pageLink, PropertyCriteriaCollection criterias)
Parameters
Type Name Description
PageReference pageLink

The root page for which the search will be performed

PropertyCriteriaCollection criterias

The criterias for pages

Returns
Type Description
PageDataCollection

A collection of pages that fulfil the criteras, will be empty if no match is found.

FindPagesWithCriteria(PageReference, PropertyCriteriaCollection, String)

Search for pages that fulfil a specific criterias

Declaration
public PageDataCollection FindPagesWithCriteria(PageReference pageLink, PropertyCriteriaCollection criterias, string languageBranch)
Parameters
Type Name Description
PageReference pageLink

The root page for which the search will be performed

PropertyCriteriaCollection criterias

The criterias for pages

System.String languageBranch

Only search for pages on specific language branch

Returns
Type Description
PageDataCollection

A collection of pages that fulfil the criteras, will be empty if no match is found.

FindPagesWithCriteria(PageReference, PropertyCriteriaCollection, String, ILanguageSelector)

Search for pages that fulfil specific criteria

Declaration
public PageDataCollection FindPagesWithCriteria(PageReference pageLink, PropertyCriteriaCollection criterias, string languageBranch, ILanguageSelector selector)
Parameters
Type Name Description
PageReference pageLink

The root page for which the search will be performed

PropertyCriteriaCollection criterias

The criterias for pages

System.String languageBranch

Only search for pages on specific language branch

ILanguageSelector selector

A language selector used to determine the language of pages to return

Returns
Type Description
PageDataCollection

A collection of pages that fulfil the criteras, will be empty if no match is found.

Exceptions
Type Condition
System.ArgumentNullException

Thrown when the pageLink is NOT vaild

Get<T>(ContentReference)

Retrives a single content item from the repository using the language selector retrieved from the current context.

Declaration
public T Get<T>(ContentReference contentLink)

    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

The content link.

Returns
Type Description
T

An IContentData object containing data.

Type Parameters
Name Description
T
Remarks

If content implements IReadOnly then the retrieved content will be read-only.

Get<T>(ContentReference, LoaderOptions)

Retrives a single content item from the repository in the language determined by the provided language selector.

Declaration
public T Get<T>(ContentReference contentLink, LoaderOptions loaderOptions)

    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

A reference to the content that you want to retrieve.

LoaderOptions loaderOptions

An LoaderOptions that will be used for example to determine the language to retrieve the content in.

Returns
Type Description
T

An IContentData object containing data.

Type Parameters
Name Description
T
Remarks

If content implements IReadOnly then the retrieved content will be read-only.

Get<T>(ContentReference, CultureInfo)

Gets the specific language of content item represented by the provided reference.

Declaration
public T Get<T>(ContentReference contentLink, CultureInfo language)

    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

The link to the content.

System.Globalization.CultureInfo language

The language

Returns
Type Description
T

The requested content item, as the specified type.

Type Parameters
Name Description
T

The type of content to get.

Remarks

If the contentLink is a specific version (that is where WorkID is set) the language is ignored and that specific version is returned.

Exceptions
Type Condition
TypeMismatchException

Is thrown if actual type is not assignable to T.

ContentNotFoundException

Is thrown if there is no IContent instance with contentLink as id.

Get<T>(Guid)

Retrives a single content item from the repository using the language selector retrieved from the current context.

Declaration
public T Get<T>(Guid contentGuid)

    where T : IContentData
Parameters
Type Name Description
System.Guid contentGuid

The content GUID.

Returns
Type Description
T

An IContentData object containing data.

Type Parameters
Name Description
T
Remarks

If content implements IReadOnly then the retrieved content will be read-only.

Exceptions
Type Condition
ContentNotFoundException

Thrown if the provided GUID is not recognized as being associated with a content item.

Get<T>(Guid, LoaderOptions)

Retrives a single content item from the repository using the language selector retrieved from the current context.

Declaration
public T Get<T>(Guid contentGuid, LoaderOptions loaderOptions)

    where T : IContentData
Parameters
Type Name Description
System.Guid contentGuid

The content GUID.

LoaderOptions loaderOptions

An LoaderOptions that will be used for example to determine the language to retrieve the content in.

Returns
Type Description
T

An IContentData object containing data.

Type Parameters
Name Description
T
Remarks

If content implements IReadOnly then the retrieved content will be read-only.

Exceptions
Type Condition
ContentNotFoundException

Thrown if the provided GUID is not recognized as being associated with a content item.

Get<T>(Guid, CultureInfo)

Gets the specific language of content item represented by the provided reference.

Declaration
public T Get<T>(Guid contentGuid, CultureInfo language)

    where T : IContentData
Parameters
Type Name Description
System.Guid contentGuid

The content identifier.

System.Globalization.CultureInfo language

The language.

Returns
Type Description
T

The requested content item, as the specified type.

Type Parameters
Name Description
T

The type of content to get.

Exceptions
Type Condition
TypeMismatchException

Is thrown if actual type is not assignable to T.

ContentNotFoundException

Is thrown if there is no IContent instance with contentGuid as id.

GetAncestors(ContentReference)

Retrieves all content items located above the specified content.

Declaration
public virtual IEnumerable<IContent> GetAncestors(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The reference to the item whose ancestors you want to retrieve.

Returns
Type Description
System.Collections.Generic.IEnumerable<IContent>

A list of all items located above the specified reference.

GetAncestors(PageReference)

Retrieves all content items located above the specified page.

Declaration
public virtual IEnumerable<IContent> GetAncestors(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

The reference to the page whose ancestors you want to retrieve.

Returns
Type Description
System.Collections.Generic.IEnumerable<IContent>

A list of all content items located above the specified reference.

GetBySegment(ContentReference, String, LoaderOptions)

Gets the child IContentData instance that has a RouteSegment that matches urlSegment.

Declaration
public virtual IContent GetBySegment(ContentReference parentLink, string urlSegment, LoaderOptions settings)
Parameters
Type Name Description
ContentReference parentLink

The parent link.

System.String urlSegment

The URL segment.

LoaderOptions settings

The settings to use.

Returns
Type Description
IContent

The content instance that matches urlSegment or null if no match.

Remarks

It is the passed in settings that is responsible to handle fallback and replacement settings for language.

GetBySegment(ContentReference, String, CultureInfo)

Gets the child IContentData instance that has a RouteSegment that matches urlSegment.

Declaration
public IContent GetBySegment(ContentReference parentLink, string urlSegment, CultureInfo language)
Parameters
Type Name Description
ContentReference parentLink

The parent link.

System.String urlSegment

The URL segment.

System.Globalization.CultureInfo language

The language

Returns
Type Description
IContent

The content instance that matches urlSegment or null if no match.

Remarks

It is the passed in language that is responsible to handle fallback and replacement settings for language.

GetChildren(PageReference)

Retrieve page listing.

Declaration
public PageDataCollection GetChildren(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

The page that you want to list the children to.

Returns
Type Description
PageDataCollection

All children to the given page.

Remarks

This methods does not filter any pages due to access rights, but it will filter pages not published for the preferred culture

GetChildren(PageReference, LoaderOptions)

Retrive page listing.

Declaration
public PageDataCollection GetChildren(PageReference pageLink, LoaderOptions settings)
Parameters
Type Name Description
PageReference pageLink

The page that you want to list the children to.

LoaderOptions settings

An LoaderOptions that will be used to for example determine the language for the child pages.

Returns
Type Description
PageDataCollection

All children to the given page.

Remarks

This methods does not filter any pages due to access rights, but it will filter pages not published for the selected language.

GetChildren(PageReference, LoaderOptions, Int32, Int32)

Retrieves a collection containing the child pages of the specified page using the provided loader settings to determine what child pages to retrieve.

Declaration
public PageDataCollection GetChildren(PageReference pageLink, LoaderOptions settings, int startIndex, int maxRows)
Parameters
Type Name Description
PageReference pageLink

The page that you want to list the children to.

LoaderOptions settings

An LoaderOptions that will be used to for example determine the language for the child pages.

System.Int32 startIndex

The start index of the listing. Used to obtain paging.

System.Int32 maxRows

The maximum amout of pages returned.

Returns
Type Description
PageDataCollection

A collection of pages that match the listing criteria.

Remarks

This methods does not filter any pages due to access rights, but it will filter pages not published for the selected language.

GetChildren(PageReference, Int32, Int32)

Retrieves a collection containing the child pages of the specified page.

Declaration
public PageDataCollection GetChildren(PageReference pageLink, int startIndex, int maxRows)
Parameters
Type Name Description
PageReference pageLink

The page whose children you want to retrieve.

System.Int32 startIndex

The start index of the listing. Used to obtain paging.

System.Int32 maxRows

The maximum amout of pages returned.

Returns
Type Description
PageDataCollection

A collection of pages that match the listing criteria.

Remarks

This methods does not filter any pages due to access rights, but it will filter pages not published for the selected language.

GetChildren<T>(ContentReference)

Retrieves a collection containing the child content of the specified link using the provided language selector to determine what child pages to retrieve.

Declaration
public IEnumerable<T> GetChildren<T>(ContentReference contentLink)

    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

The content link.

Returns
Type Description
System.Collections.Generic.IEnumerable<T>

A collection of pages that match the listing criteria.

Type Parameters
Name Description
T
Remarks

This methods does not filter any content due to access rights, but it will filter content not published for the selected language.

GetChildren<T>(ContentReference, LoaderOptions)

Retrieves a collection containing the child content of the specified link using the provided loader settings to determine what child pages to retrieve.

Declaration
public IEnumerable<T> GetChildren<T>(ContentReference contentLink, LoaderOptions loaderOptions)

    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

The content link.

LoaderOptions loaderOptions

An LoaderOptions that will be used to determine the language for the child content.

Returns
Type Description
System.Collections.Generic.IEnumerable<T>

A collection of pages that match the listing criteria.

Type Parameters
Name Description
T
Remarks

This methods does not filter any content due to access rights, but it will filter content not published for the selected language.

GetChildren<T>(ContentReference, LoaderOptions, Int32, Int32)

Retrieves a collection containing the child content of the specified link using the provided loader setting to determine what child pages to retrieve.

Declaration
public IEnumerable<T> GetChildren<T>(ContentReference contentLink, LoaderOptions settings, int startIndex, int maxRows)

    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

The reference that you want to list the children to.

LoaderOptions settings

An LoaderOptions that will be used to for example determine the language for the child content.

System.Int32 startIndex

The start index of the listing. Used to obtain paging.

System.Int32 maxRows

The maximum amout of pages returned.

Returns
Type Description
System.Collections.Generic.IEnumerable<T>

A collection of pages that match the listing criteria.

Type Parameters
Name Description
T
Remarks

This methods does not filter any content due to access rights, but it will filter content not published for the selected language.

GetChildren<T>(ContentReference, CultureInfo)

Gets the children of the content item represented by the provided reference given the language.

Declaration
public IEnumerable<T> GetChildren<T>(ContentReference contentLink, CultureInfo language)

    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

A reference to the parent whose children should be returned.

System.Globalization.CultureInfo language

The language.

Returns
Type Description
System.Collections.Generic.IEnumerable<T>

The children of the specifed parent, as the specified type.

Type Parameters
Name Description
T

The type of children to get.

GetChildren<T>(ContentReference, CultureInfo, Int32, Int32)

Gets the children of the content item represented by the provided reference given the language.

Declaration
public IEnumerable<T> GetChildren<T>(ContentReference contentLink, CultureInfo language, int startIndex, int maxRows)

    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

A reference to the parent whose children should be returned.

System.Globalization.CultureInfo language

The language.

System.Int32 startIndex

The index of the first child to return.

System.Int32 maxRows

The max number of children to return.

Returns
Type Description
System.Collections.Generic.IEnumerable<T>

The children of the specifed parent, as the specified type.

Type Parameters
Name Description
T

The type of children to get.

Remarks

This is the overload of GetChildren that supports paging.

GetDefault<T>(ContentReference)

Gets a new default instance of an IContentData object for the given type, placed at the location of the parent provided and initialized with the default values for the content type. The language of the content item is determined from PreferredCulture.

Declaration
public T GetDefault<T>(ContentReference parentLink)

    where T : IContentData
Parameters
Type Name Description
ContentReference parentLink

The parent link.

Returns
Type Description
T

A IContent object for the given ContentType, initialized with the default values for the content type.

Type Parameters
Name Description
T

The type of content to create.

Exceptions
Type Condition
AccessDeniedException

Thrown AccessDeniedException when user doesnt have access right to perform this action

GetDefault<T>(ContentReference, ILanguageSelector)

Gets a new default instance of an IContent object for the given type, placed at the location of the parent provided and initialized with the default values for the content type. The language of the content item is determined from the language selector provided.

Declaration
[Obsolete("Use GetDefault<T>(ContentReference parentLink, CultureInfo language)")]
public T GetDefault<T>(ContentReference parentLink, ILanguageSelector languageSelector)

    where T : IContentData
Parameters
Type Name Description
ContentReference parentLink

The parent link.

ILanguageSelector languageSelector

An ILanguageSelector that will be used to determine the language of the created item.

Returns
Type Description
T

A IContent object for the given ContentType, initialized with the default values for the content type.

Type Parameters
Name Description
T

The type of content to create.

Exceptions
Type Condition
System.NotSupportedException

Thrown when there is no ContentType registered for T.

GetDefault<T>(ContentReference, CultureInfo)

Gets a new default instance of an IContent object for the given type, placed at the location of the parent provided and initialized with the default values for the content type. The language of the content item is determined from the language selector provided.

Declaration
public T GetDefault<T>(ContentReference parentLink, CultureInfo language)

    where T : IContentData
Parameters
Type Name Description
ContentReference parentLink

The parent link.

System.Globalization.CultureInfo language

The language of the created item.

Returns
Type Description
T

A IContent object for the given ContentType, initialized with the default values for the content type.

Type Parameters
Name Description
T

The type of content to create.

Exceptions
Type Condition
System.NotSupportedException

Thrown when there is no ContentType registered for T.

GetDefault<T>(ContentReference, Int32)

Gets a new default instance of an IContentData object for the given type, placed at the location of the parent provided and initialized with the default values for the content type. The language of the content item is determined from the LanguageResolver.

Declaration
public T GetDefault<T>(ContentReference parentLink, int contentTypeID)

    where T : IContentData
Parameters
Type Name Description
ContentReference parentLink

The parent link.

System.Int32 contentTypeID

The ID of the content type that the content item should be created as.

Returns
Type Description
T

A IContent object for the given ContentType, initialized with the default values for the content type.

Type Parameters
Name Description
T

The type of content to create.

Exceptions
Type Condition
AccessDeniedException

Thrown AccessDeniedException when user doesn't have access right to perform this action

GetDefault<T>(ContentReference, Int32, ILanguageSelector)

Retrieves a IContentData object for the given ContentType, placed at the location of the parent provided and initialized with the default values for the content type. The language of the content item is determined from the language selector provided.

Declaration
[Obsolete("Use GetDefault<T>(ContentReference parentLink, int contentTypeID, CultureInfo language)")]
public T GetDefault<T>(ContentReference parentLink, int contentTypeID, ILanguageSelector selector)

    where T : IContentData
Parameters
Type Name Description
ContentReference parentLink

The parent link.

System.Int32 contentTypeID

The ID of the content type that the content item should be created as.

ILanguageSelector selector

An ILanguageSelector that will be used to determine the language of the created item.

Returns
Type Description
T

A IContentData object for the given ContentType, initialized with the default values for the content type.

Type Parameters
Name Description
T
Exceptions
Type Condition
AccessDeniedException

Thrown AccessDeniedException when user doesnt have access right to perform this action

GetDefault<T>(ContentReference, Int32, CultureInfo)

Retrieves a IContentData object for the given ContentType, placed at the location of the parent provided and initialized with the default values for the content type. The language of the content item is determined from the language selector provided.

Declaration
public T GetDefault<T>(ContentReference parentLink, int contentTypeID, CultureInfo language)

    where T : IContentData
Parameters
Type Name Description
ContentReference parentLink

The parent link.

System.Int32 contentTypeID

The ID of the content type that the content item should be created as.

System.Globalization.CultureInfo language

The language of the created item.

Returns
Type Description
T

A IContentData object for the given ContentType, initialized with the default values for the content type.

Type Parameters
Name Description
T
Exceptions
Type Condition
AccessDeniedException

Thrown AccessDeniedException when user doesnt have access right to perform this action

GetDefaultPageData(PageReference, Int32)

Retrieves a PageData object for the given PageType, placed at the location of the parent page provided and initialized with the default values for the page type.

Declaration
[Obsolete("Use GetDefault<T>(ContentReference parentLink, int contentTypeID)")]
public PageData GetDefaultPageData(PageReference parentPageLink, int pageTypeID)
Parameters
Type Name Description
PageReference parentPageLink

The parent page of the "virtual" new page.

System.Int32 pageTypeID

The ID of the page type that the page should be created as.

Returns
Type Description
PageData

A PageData object for the given PageType, initialized with the default values for the page type.

GetDefaultPageData(PageReference, Int32, ILanguageSelector)

Retrieves a PageData object for the given PageType, placed at the location of the parent page provided and initialized with the default values for the page type. The language of the page is determined from the language selector provided.

Declaration
[Obsolete("Use GetDefault<T>(ContentReference parentLink, int contentTypeID, CultureInfo language)")]
public PageData GetDefaultPageData(PageReference parentPageLink, int pageTypeID, ILanguageSelector selector)
Parameters
Type Name Description
PageReference parentPageLink

The parent page of the "virtual" new page.

System.Int32 pageTypeID

The ID of the page type that the page should be created as.

ILanguageSelector selector

An ILanguageSelector that will be used to determine the language of the created page.

Returns
Type Description
PageData

A PageData object for the given PageType, initialized with the default values for the page type.

Exceptions
Type Condition
AccessDeniedException

Thrown AccessDeniedException when user doesnt have access right to perform this action

System.ArgumentNullException

Thrown when the parentPageLink is NOT vaild

GetDefaultPageData(PageReference, String)

Get a PageData object with default values.

Declaration
[Obsolete("Use GetDefault<T>(ContentReference parentLink, int contentTypeID)")]
public PageData GetDefaultPageData(PageReference parentPageLink, string pageTypeName)
Parameters
Type Name Description
PageReference parentPageLink

The parent page of the "virtual" new page.

System.String pageTypeName

The page type name of the new page.

Returns
Type Description
PageData

A PageData object that contains the default values for a new page of the indicated type.

GetDefaultPageData(PageReference, String, ILanguageSelector)

Get a PageData object with default values.

Declaration
[Obsolete("Use GetDefault<T>(ContentReference parentLink, int contentTypeID, CultureInfo language)")]
public PageData GetDefaultPageData(PageReference parentPageLink, string pageTypeName, ILanguageSelector selector)
Parameters
Type Name Description
PageReference parentPageLink

The parent page of the "virtual" new page.

System.String pageTypeName

The page type of the new page.

ILanguageSelector selector

A selector to help select language

Returns
Type Description
PageData

A PageData object that contains the default values for a new page of the indicated type.

GetDefaultPageData<T>(PageReference)

Retrieves a page object for the PageType that matches the generic type parameter. The page will be placed at the location of the parent page provided and initialized with the default values for the page type.

Declaration
[Obsolete("Use GetDefault<T>(ContentReference parentLink)")]
public T GetDefaultPageData<T>(PageReference parentPageLink)

    where T : PageData
Parameters
Type Name Description
PageReference parentPageLink

The parent page of the "virtual" new page.

Returns
Type Description
T

A page object for the given PageType of the same type as the generic type parameter, initialized with the default values for the page type.

Type Parameters
Name Description
T

The type associated with the PageType and the type of the PageData object to return.

GetDefaultPageData<T>(PageReference, ILanguageSelector)

Retrieves a page object for the PageType that matches the generic type parameter. The page will be placed at the location of the parent page provided and initialized with the default values for the page type. The language of the page is decided from the language selector provided.

Declaration
[Obsolete("Use GetDefault<T>(ContentReference parentLink, CultureInfo language)")]
public T GetDefaultPageData<T>(PageReference parentPageLink, ILanguageSelector selector)

    where T : PageData
Parameters
Type Name Description
PageReference parentPageLink

The parent page of the "virtual" new page.

ILanguageSelector selector

An ILanguageSelector that will be used to determine the language of the created page.

Returns
Type Description
T

A page object for the given PageType of the same type as the generic type parameter, initialized with the default values for the page type.

Type Parameters
Name Description
T

The type associated with the PageType and the type of the PageData object to return.

GetDescendents(ContentReference)

Retrieves all references located anywhere below the provided reference.

Declaration
public IEnumerable<ContentReference> GetDescendents(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The reference whose descendents you want to retrieve.

Returns
Type Description
System.Collections.Generic.IEnumerable<ContentReference>

A list of references to all descendents.

Remarks

If only descendent for one level is needed GetChildren is probably more efficient since this method will get all descentents. In case of a large tree this can take some time.

GetDescendents(PageReference)

Retrieves all pages located anywhere below the provided page.

Declaration
public IList<PageReference> GetDescendents(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

The page whose descendents you want to retrieve.

Returns
Type Description
System.Collections.Generic.IList<PageReference>

A list of references to all descendents.

Remarks

If only descendent for one level is needed GetChildren is probably more efficient since this method will get all descentents. In case of a large tree this can take some time.

GetItems(IEnumerable<ContentReference>, LoaderOptions)

Gets all content items that is represented by the provided references in the language given by the provided loader setting.

Declaration
public IEnumerable<IContent> GetItems(IEnumerable<ContentReference> contentLinks, LoaderOptions settings)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<ContentReference> contentLinks

A list of references to content that should be fetched.

LoaderOptions settings

The setting that for example provides the language to get the content in.

Returns
Type Description
System.Collections.Generic.IEnumerable<IContent>

A list of content for the specifed references.

Remarks

For references that specifies a specific version (that is where WorkID is set) the settings is ignored and that specific version is returned.

If contentLinks contain duplicate entries only one IContent instance is returned for the duplicate entries.

GetItems(IEnumerable<ContentReference>, CultureInfo)

Gets all content items that is represented by the provided references given the language.

Declaration
public IEnumerable<IContent> GetItems(IEnumerable<ContentReference> contentLinks, CultureInfo language)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<ContentReference> contentLinks

A list of references to content that should be fetched.

System.Globalization.CultureInfo language

The language.

Returns
Type Description
System.Collections.Generic.IEnumerable<IContent>

A list of content for the specifed references.

Remarks

For references that specifies a specific version (that is where WorkID is set) the language is ignored and that specific version is returned.

If contentLinks contain duplicate entries only one IContent instance is returned for the duplicate entries.

GetLanguageBranches(PageReference)

Retrieves a collection of PageData objects for all languages of the provided page.

Declaration
public PageDataCollection GetLanguageBranches(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

The page whose language branches you want to retrieve.

Returns
Type Description
PageDataCollection

A collection of pages for all language branches for the page.

Exceptions
Type Condition
System.ArgumentNullException

Thrown when the pageLink is NOT vaild

GetLanguageBranches<T>(ContentReference)

Retrieves a collection of IContentData objects for all languages of the provided content link.

Declaration
public IEnumerable<T> GetLanguageBranches<T>(ContentReference contentLink)

    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

The reference whose language branches you want to retrieve.

Returns
Type Description
System.Collections.Generic.IEnumerable<T>

A collection of IContentData for all language branches.

Type Parameters
Name Description
T

GetLinksToPages(PageReference)

Retrieves a collection of all pages that references the provided page.

Declaration
[Obsolete("Use GetReferencesToContent instead")]
public PageReferenceCollection GetLinksToPages(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

The page that you want to find all links to.

Returns
Type Description
PageReferenceCollection

A collection of all pages that contains one or more references to the provided page.

GetPage(PageReference)

Retrives a single page from the repository using the language selector retrieved from the current context.

Declaration
public PageData GetPage(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

A reference to the page that you want to retrieve.

Returns
Type Description
PageData

A read-only PageData object containing the page data.

Remarks

The retrieved page will be read-only.

Exceptions
Type Condition
PageNotFoundException

Throws a PageNotFoundException if the page does not exist.

GetPage(PageReference, LoaderOptions)

Retrives a single page from the repository in the language determined by the provided loader settings.

Declaration
public PageData GetPage(PageReference pageLink, LoaderOptions settings)
Parameters
Type Name Description
PageReference pageLink

A reference to the page that you want to retrieve.

LoaderOptions settings

An LoaderOptions that will be used to for example determine the language to retrieve the page in.

Returns
Type Description
PageData

A read-only PageData object containing the page data.

Remarks

The retrieved page will be read-only.

GetPages(IList<PageReference>, LoaderOptions)

Retrives a collection of pages from the repository in the language determined by the provided loader settings.

Declaration
public PageDataCollection GetPages(IList<PageReference> pageLinks, LoaderOptions loaderOptions)
Parameters
Type Name Description
System.Collections.Generic.IList<PageReference> pageLinks

A list of references to the pages to retrieved.

LoaderOptions loaderOptions

An LoaderOptions that will be used to for example determine the language to retrieve the pages in.

Returns
Type Description
PageDataCollection

A collection of read-only PageData objects.

GetParents(PageReference)

Retrieves all pages located above the specified page in the form of a PagePath.

Declaration
[Obsolete("Use GetAncestors to get all parents.")]
public PagePath GetParents(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

The page whose ascendents you want to retrieve.

Returns
Type Description
PagePath

A PagePath containing all pages located above the specified page.

GetProvider(ContentReference)

Gets the content provider for a provider name.

Declaration
public ContentProvider GetProvider(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The content link.

Returns
Type Description
ContentProvider

The content provider as an ContentProvider.

GetProvider(String)

Gets the content provider for a provider name.

Declaration
public ContentProvider GetProvider(string providerName)
Parameters
Type Name Description
System.String providerName

Name of the provider.

Returns
Type Description
ContentProvider

The content provider as an ContentProvider.

GetReferencesToContent(ContentReference, Boolean)

Gets the reference information of the references to the specified content and optionally its decendents.

Declaration
public IEnumerable<ReferenceInformation> GetReferencesToContent(ContentReference contentLink, bool includeDecendents)
Parameters
Type Name Description
ContentReference contentLink

The content link.

System.Boolean includeDecendents

if set to true references to decendents is also checked.

Returns
Type Description
System.Collections.Generic.IEnumerable<ReferenceInformation>

GetSettingsFromContent(ContentReference)

Gets the (Enterprise) settings for a content item.

Declaration
public Settings GetSettingsFromContent(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The content link.

Returns
Type Description
Settings

A Settings instance for the site that contentLink belongs to.

Remarks

This is done by traversing the page tree upwards from contentLink until a Page which has an Enterprise config's StartPage set as current page, or the StartPage of the current IIsInstanceId.

GetSettingsFromContent(ContentReference, Boolean)

Gets the (Enterprise) settings for a content.

Declaration
public Settings GetSettingsFromContent(ContentReference contentLink, bool fallbackToStartPageId)
Parameters
Type Name Description
ContentReference contentLink

The content link.

System.Boolean fallbackToStartPageId

if set to true, activate fallback to Start page for Settings. See Remarks for more details.

Returns
Type Description
Settings

A Settings instance for the site that contentLink belongs to.

Remarks

This is done by traversing the page tree upwards from current link until a Page which has an Enterprise config's StartPage set as current page, or the StartPage of the current IIsInstanceId.

If the contentLink is not located beneath a start page, the search will fall back to the Settings instance for the current start page if fallbackToStartPageId is set to True. If the search fails and fallbackToStartPageId is set to false, the method returns null.

GetSettingsFromPage(ContentReference)

Gets the (Enterprise) settings for a page.

Declaration
[Obsolete("Use method GetSettingsForContent instead")]
public Settings GetSettingsFromPage(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink
Returns
Type Description
Settings

GetSettingsFromPage(ContentReference, Boolean)

Gets the (Enterprise) settings for a page.

Declaration
[Obsolete("Use method GetSettingsForContent instead")]
public Settings GetSettingsFromPage(ContentReference contentLink, bool fallbackToStartPageId)
Parameters
Type Name Description
ContentReference contentLink
System.Boolean fallbackToStartPageId
Returns
Type Description
Settings

HasEntryPointChild(ContentReference)

Check if this content reference is or has entry point as child.

Declaration
public bool HasEntryPointChild(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink
Returns
Type Description
System.Boolean

true if content itself or some of it's descendants is an entry point to a content provider

Initialize(EPiServerSection)

Initializes the provider map and permanent link mapper using data factory.

Declaration
public void Initialize(EPiServerSection configuration)
Parameters
Type Name Description
EPiServerSection configuration

The configuration.

IsCapabilitySupported(ContentReference, ContentProviderCapabilities)

Determines whether the page provider serving the specified page has the specified capability.

Declaration
public bool IsCapabilitySupported(ContentReference contentLink, ContentProviderCapabilities capability)
Parameters
Type Name Description
ContentReference contentLink

The page link.

ContentProviderCapabilities capability

The capability.

Returns
Type Description
System.Boolean

true if the provider supprots the specified capability; otherwise, false.

IsCapabilitySupported(ContentReference, PageProviderCapabilities)

Determines whether the page provider serving the specified page has the specified capability.

Declaration
[Obsolete("Use IsCapabilitySupported(ContentReference contentLink, ContentProviderCapabilities capability) instead")]
public bool IsCapabilitySupported(ContentReference contentLink, PageProviderCapabilities capability)
Parameters
Type Name Description
ContentReference contentLink

The page link.

PageProviderCapabilities capability

The capability.

Returns
Type Description
System.Boolean

true if the provider supprots the specified capability; otherwise, false.

IsWastebasket(ContentReference)

Determines whether the specified page link is wastebasket for any page provider

Declaration
public bool IsWastebasket(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The page link.

Returns
Type Description
System.Boolean

true if the specified page link is a wastebasket; otherwise, false.

ListDelayedPublish()

Lists all pages with a delayed publish date.

Declaration
[Obsolete("Use IContentRepository.ListDelayedPublish")]
public PageDataCollection ListDelayedPublish()
Returns
Type Description
PageDataCollection

A PageDataCollection of all pages with a delayed publish date.

ListPublishedVersions(PageReference)

Lists the published versions for a page

Declaration
public PageVersionCollection ListPublishedVersions(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

The page link.

Returns
Type Description
PageVersionCollection

All published versions for the page

ListVersions(PageReference)

Lists all versions

Declaration
public PageVersionCollection ListVersions(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

The page link.

Returns
Type Description
PageVersionCollection

All matching versions

ListVersions(PageReference, String)

Lists all versions for a page current language selection if the languageBranch is null otherwise Lists all versions for a page for a specific language

Declaration
public PageVersionCollection ListVersions(PageReference pageLink, string languageBranch)
Parameters
Type Name Description
PageReference pageLink

The page link.

System.String languageBranch

The language branch

Returns
Type Description
PageVersionCollection

All matching versions

LoadPublishedVersion(PageReference)

Loads the published version

Declaration
public PageVersion LoadPublishedVersion(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

The page link.

Returns
Type Description
PageVersion

LoadPublishedVersion(PageReference, String)

Loads the published version a page with current language selection if the languageBranch is null otherwise Loads the published version a page for a specific language

Declaration
public PageVersion LoadPublishedVersion(PageReference pageLink, string languageBranch)
Parameters
Type Name Description
PageReference pageLink

The page link.

System.String languageBranch

The language branch.

Returns
Type Description
PageVersion

LoadVersion(PageReference)

Loads the version.

Declaration
public PageVersion LoadVersion(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

The page link.

Returns
Type Description
PageVersion

Move(ContentReference, ContentReference, AccessLevel, AccessLevel)

Moves a page from it's current location to another position in the page structure first ensuring that the current user meets the minimal access right requirements.

Declaration
public ContentReference Move(ContentReference contentLink, ContentReference destinationLink, AccessLevel requiredSourceAccess, AccessLevel requiredDestinationAccess)
Parameters
Type Name Description
ContentReference contentLink

The page that should be moved.

ContentReference destinationLink

The destination page where the page will be moved as a child to.

AccessLevel requiredSourceAccess

The minimal access rights required on the source page that is to be moved.

AccessLevel requiredDestinationAccess

The minimal access rights required on the destination page.

Returns
Type Description
ContentReference

A ContentReference to the moved content.

Exceptions
Type Condition
AccessDeniedException

Thrown AccessDeniedException when user does not have access right to perform this action.

Move(PageReference, PageReference)

Move a page to another container

Declaration
public ContentReference Move(PageReference pageLink, PageReference destinationLink)
Parameters
Type Name Description
PageReference pageLink

The link to the page to move

PageReference destinationLink

The container to which the page will be moved

Returns
Type Description
ContentReference

A ContentReference to the moved content.

Remarks

Access rights required:

Exceptions
Type Condition
AccessDeniedException

Thrown AccessDeniedException when user does not have enough access right to perform this action.

Move(PageReference, PageReference, AccessLevel, AccessLevel)

Moves a page from it's current location to another position in the page structure first ensuring that the current user meets the minimal access right requirements.

Declaration
public ContentReference Move(PageReference pageLink, PageReference destination, AccessLevel requiredSourceAccess, AccessLevel requiredDestinationAccess)
Parameters
Type Name Description
PageReference pageLink

The page that should be moved.

PageReference destination

The destination page where the page will be moved as a child to.

AccessLevel requiredSourceAccess

The minimal access rights required on the source page that is to be moved.

AccessLevel requiredDestinationAccess

The minimal access rights required on the destination page.

Returns
Type Description
ContentReference

A ContentReference to the moved content.

MoveToWastebasket(ContentReference, String)

Moves a page to the wastebasket.

Declaration
public void MoveToWastebasket(ContentReference contentLink, string deletedBy)
Parameters
Type Name Description
ContentReference contentLink

The content that should be moved to the wastebasket.

System.String deletedBy

The user who deleted the content.

Exceptions
Type Condition
System.ArgumentNullException

Thrown when the contentLink is NOT vaild

AccessDeniedException

Thrown when the user does not have access rights to delete the content

CannotMoveProviderException

Thrown when this page or some of it's descendants is parent to a content provider and it can't be deleted.

MoveToWastebasket(PageReference)

Moves a page to the wastebasket.

Declaration
public void MoveToWastebasket(PageReference pageLink)
Parameters
Type Name Description
PageReference pageLink

The page that should be moved to the wastebasket.

OnContentSecurityDescriptorSaved(ContentReference, IContentSecurityDescriptor, SecuritySaveType)

Called when [content security descriptor saved].

Declaration
[Obsolete("The raising of IContentSecurityRepository.ContentSecuritySaved is not supported. It is up to the IContentSecurityRepository to raise the event.")]
protected void OnContentSecurityDescriptorSaved(ContentReference contentLink, IContentSecurityDescriptor contentSecurityDescriptor, SecuritySaveType securitySaveType)
Parameters
Type Name Description
ContentReference contentLink

The content link.

IContentSecurityDescriptor contentSecurityDescriptor

The content security descriptor.

SecuritySaveType securitySaveType

Type of the security save.

ResetCounters()

Resets all counters on all PageProviders

Declaration
public void ResetCounters()

ResolveContentFolder(Int32)

Tries to resolve which content that owns the content folder with specified id.

Declaration
public ContentReference ResolveContentFolder(int pageFolderId)
Parameters
Type Name Description
System.Int32 pageFolderId

The content folder id.

Returns
Type Description
ContentReference

The link to the content if match is found else ContentReference.EmptyReference is returned.

ResolvePageFolder(Int32)

Resolves the page folder.

Declaration
[Obsolete("Use ResolveContentFolder instead")]
public PageReference ResolvePageFolder(int pageFolderId)
Parameters
Type Name Description
System.Int32 pageFolderId

The page folder id.

Returns
Type Description
PageReference

Save(IContent, SaveAction, AccessLevel)

Saves a content item to the repository with the provided save action performed first ensuring that the current user meets the mininum access rights requirements.

Declaration
public ContentReference Save(IContent content, SaveAction action, AccessLevel access)
Parameters
Type Name Description
IContent content

The content.

SaveAction action

The SaveAction that should be performed.

AccessLevel access

The minimum access level that the current user must have to the content item.

Returns
Type Description
ContentReference

A ContentReference to the saved content item.

Exceptions
Type Condition
AccessDeniedException

Thrown AccessDeniedException when user doesnt have access right to perform this action

EPiServerCancelException

Thrown when the CreatingEvent, SavingEvent, PublishingEvent or SavingEvent is canceled

System.ArgumentNullException

Thrown when the content item is null

Save(PageData, SaveAction)

Save page

Declaration
public PageReference Save(PageData page, SaveAction action)
Parameters
Type Name Description
PageData page

An initialized PageData object containing data to be saved

SaveAction action

Action that will be performed

Returns
Type Description
PageReference
Remarks

Note: The action parameter is a SaveAction enumeration that is located in a non-documented part of the SDK. You can however use it as it is a part of the EPiServer API and available from code.

If PageLink is empty a new page will be created

Access right required:

The following example shows how to programmatically create a page.

The following example shows how to edit and save en existing page.

Exceptions
Type Condition
AccessDeniedException

Thrown AccessDeniedException when user doesn't have enough access rights to perform this action

Save(PageData, SaveAction, AccessLevel)

Saves a page to the repository with the provided save action performed first ensuring that the current user meets the mininum access rights requirements.

Declaration
public PageReference Save(PageData page, SaveAction action, AccessLevel access)
Parameters
Type Name Description
PageData page

An PageData object containing all the data that should be saved.

SaveAction action

The SaveAction that should be performed.

AccessLevel access

The minimum access level that the current user must have to the page.

Returns
Type Description
PageReference

A PageReference to the saved page.

Exceptions
Type Condition
AccessDeniedException

Thrown AccessDeniedException when user doesnt have access right to perform this action

EPiServerCancelException

Thrown when the CreatingEvent, SavingEvent, PublishingEvent or SavingEvent is canceled

System.ArgumentNullException

Thrown when the page is null

TryGet<T>(ContentReference, out T)

Gets the content item represented by the provided reference.

Declaration
public bool TryGet<T>(ContentReference contentLink, out T content)

    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

The link to the content.

T content

The content with given id or null if content not found or if type is not assignable to T.

Returns
Type Description
System.Boolean

True if content is found or false if content is not found or if found content is of a type not assignable to T.

Type Parameters
Name Description
T

The type of content to get.

TryGet<T>(ContentReference, LoaderOptions, out T)

Gets the content item represented by the provided reference.

Declaration
public bool TryGet<T>(ContentReference contentLink, LoaderOptions loaderOptions, out T content)

    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

The link to the content.

LoaderOptions loaderOptions

The settings that provides for example the language to get the content in.

T content

The content with given id or null if content not found or if type is not assignable to T.

Returns
Type Description
System.Boolean

True if content is found or false if content is not found or if found content is of a type not assignable to T.

Type Parameters
Name Description
T

The type of content to get.

Exceptions
Type Condition
System.ArgumentNullException

contentLink;The provided content link does not have a value.

TryGet<T>(ContentReference, CultureInfo, out T)

Gets the content item represented by the provided reference given the language.

Declaration
public bool TryGet<T>(ContentReference contentLink, CultureInfo language, out T content)

    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

The link to the content.

System.Globalization.CultureInfo language

The language.

T content

The content with given id or null if content not found or if type is not assignable to T.

Returns
Type Description
System.Boolean

True if content is found or false if content is not found or if found content is of a type not assignable to T.

Type Parameters
Name Description
T

The type of content to get.

Remarks

If the contentLink is a specific version (that is where WorkID is set) the language is ignored and that specific version is returned.

TryGet<T>(Guid, out T)

Gets the content item represented by the provided reference.

Declaration
public bool TryGet<T>(Guid contentGuid, out T content)

    where T : IContentData
Parameters
Type Name Description
System.Guid contentGuid

The unique identifier for the content.

T content

The content with given id or null if content not found or if type is not assignable to T.

Returns
Type Description
System.Boolean

True if content is found or false if content is not found or if found content is of a type not assignable to T.

Type Parameters
Name Description
T

The type of content to get.

TryGet<T>(Guid, LoaderOptions, out T)

Gets the content item represented by the provided reference.

Declaration
public bool TryGet<T>(Guid contentGuid, LoaderOptions loaderOptions, out T content)

    where T : IContentData
Parameters
Type Name Description
System.Guid contentGuid

The unique identifier for the content.

LoaderOptions loaderOptions

The settings that specifies how the content should be loaded, e.g. the language to get the content in.

T content

The content with given id or null if content not found or if type is not assignable to T.

Returns
Type Description
System.Boolean

True if content is found or false if content is not found or if found content is of a type not assignable to T.

Type Parameters
Name Description
T

The type of content to get.

TryGet<T>(Guid, CultureInfo, out T)

Gets the content item represented by the provided reference given the language.

Declaration
public bool TryGet<T>(Guid contentGuid, CultureInfo language, out T content)

    where T : IContentData
Parameters
Type Name Description
System.Guid contentGuid

The guid to the content.

System.Globalization.CultureInfo language

The language.

T content

The content with given id or null if content not found or if type is not assignable to T.

Returns
Type Description
System.Boolean

True if content is found or false if content is not found or if found content is of a type not assignable to T.

Type Parameters
Name Description
T

The type of content to get.

Explicit Interface Implementations

IContentModelUsage.IsContentTypeUsed(ContentType)

Performs a check if specified ContentType is used.

This method is for example called before a content type defined in code is deleted.

Declaration
bool IContentModelUsage.IsContentTypeUsed(ContentType contentType)
Parameters
Type Name Description
ContentType contentType

The contentType to return references for.

Returns
Type Description
System.Boolean

IContentModelUsage.IsPropertyDefinitionUsed(PropertyDefinition)

Performs a check if specified PropertyDefinition is used.

This method is for example called before a property definition type defined in code is deleted.

Declaration
bool IContentModelUsage.IsPropertyDefinitionUsed(PropertyDefinition propertyDefinition)
Parameters
Type Name Description
PropertyDefinition propertyDefinition

The property definition.

Returns
Type Description
System.Boolean

true if property definition is used; otherwise, false.

IContentModelUsage.ListContentOfContentType(ContentType)

Gets a list of references to pages of specified PageType.

This method is for example called before a page type defined in code is deleted.

Declaration
IList<ContentUsage> IContentModelUsage.ListContentOfContentType(ContentType contentType)
Parameters
Type Name Description
ContentType contentType

The contentType to return references for.

Returns
Type Description
System.Collections.Generic.IList<ContentUsage>

IContentModelUsage.ListContentWithPropertyDefinition(PropertyDefinition, Boolean, Boolean)

Gets the pages with instance of page definition.

This method is for example called before a page definition defined in code is deleted.

Declaration
IList<ContentUsage> IContentModelUsage.ListContentWithPropertyDefinition(PropertyDefinition propertyDefinition, bool onlyNoneMasterLanguage, bool onlyPublished)
Parameters
Type Name Description
PropertyDefinition propertyDefinition

The property definition.

System.Boolean onlyNoneMasterLanguage

if set to true only none master language are taken into account.

System.Boolean onlyPublished

if set to true only published versions are taken into account.

Returns
Type Description
System.Collections.Generic.IList<ContentUsage>

IContentSource.CurrentContent

Gets the currently loaded IContent.

Declaration
IContent IContentSource.CurrentContent { get; }
Returns
Type Description
IContent

Returns information about the currently loaded content, or a content in a collection when used inside a control.

IContentSource.Get<T>(ContentReference)

Retrieves a IContent object with information about a content, based on the ContentReference parameter.

Declaration
T IContentSource.Get<T>(ContentReference contentLink)

    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

Reference to the content being retrieved

Returns
Type Description
T

IContent object requested

Type Parameters
Name Description
T

IContentSource.GetChildren<T>(ContentReference)

Retrieve a IContent listing

Declaration
IEnumerable<T> IContentSource.GetChildren<T>(ContentReference contentLink)

    where T : IContentData
Parameters
Type Name Description
ContentReference contentLink

Reference to parent content

Returns
Type Description
System.Collections.Generic.IEnumerable<T>

Returns a collection of IContent directly below the content referenced by the ContentReference parameter.

Type Parameters
Name Description
T

IContentVersionRepository.Delete(ContentReference)

Delete a single version of a Content

Declaration
void IContentVersionRepository.Delete(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The content link.

IContentVersionRepository.List(ContentReference)

Lists all versions

Declaration
IEnumerable<ContentVersion> IContentVersionRepository.List(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The content link.

Returns
Type Description
System.Collections.Generic.IEnumerable<ContentVersion>

All matching versions

IContentVersionRepository.List(ContentReference, String)

Lists all versions for a page current language selection if the languageBranch is null otherwise lists all versions for a page for a specific language

Declaration
IEnumerable<ContentVersion> IContentVersionRepository.List(ContentReference contentLink, string languageBranch)
Parameters
Type Name Description
ContentReference contentLink

The content link.

System.String languageBranch

The language branch

Returns
Type Description
System.Collections.Generic.IEnumerable<ContentVersion>

All matching versions

Remarks

In case content instance does not support ILocalizable then underlying provider is called without language.

IContentVersionRepository.ListDelayedPublish()

Lists all content references that are set to delayed publish.

Declaration
IEnumerable<ContentReference> IContentVersionRepository.ListDelayedPublish()
Returns
Type Description
System.Collections.Generic.IEnumerable<ContentReference>

All matching content Versions

IContentVersionRepository.ListPublished(ContentReference)

Lists the published versions for a content

Declaration
IEnumerable<ContentVersion> IContentVersionRepository.ListPublished(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The content link.

Returns
Type Description
System.Collections.Generic.IEnumerable<ContentVersion>

All published versions for the content

IContentVersionRepository.Load(ContentReference)

Loads the version.

Declaration
ContentVersion IContentVersionRepository.Load(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The content link.

Returns
Type Description
ContentVersion

A PageVersion

IContentVersionRepository.LoadCommonDraft(ContentReference, String)

Loads the common draft.

Declaration
ContentVersion IContentVersionRepository.LoadCommonDraft(ContentReference contentLink, string language)
Parameters
Type Name Description
ContentReference contentLink

The content link to load common draft for.

System.String language

The language.

Returns
Type Description
ContentVersion

CommonDraft if it exist, otherwise Published, If no published exist the latest saved version is returned

Remarks

In case content instance does not support ILocalizable then underlying provider is called with language=null

IContentVersionRepository.LoadPublished(ContentReference)

Loads the published version

Declaration
ContentVersion IContentVersionRepository.LoadPublished(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The content link.

Returns
Type Description
ContentVersion

A PageVersion

IContentVersionRepository.LoadPublished(ContentReference, String)

Loads the published version a page with current language selection if the languageBranch is null otherwise loads the published version a page for a specific language

Declaration
ContentVersion IContentVersionRepository.LoadPublished(ContentReference contentLink, string languageBranch)
Parameters
Type Name Description
ContentReference contentLink

The content link.

System.String languageBranch

The language branch.

Returns
Type Description
ContentVersion

A PageVersion

Remarks

In case content instance does not support ILocalizable then underlying provider is called without language.

IContentVersionRepository.SetCommonDraft(ContentReference)

Sets the specified version as common draft.

Declaration
void IContentVersionRepository.SetCommonDraft(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The content link.

IContentSecurityRepository.ContentSecuritySaved

Occurs when [content security saved].

Declaration
event EventHandler<ContentSecurityEventArg> IContentSecurityRepository.ContentSecuritySaved
Returns
Type Description
System.EventHandler<ContentSecurityEventArg>

IContentSecurityRepository.Delete(String, SecurityEntityType)

Deletes the specified user or role name.

Declaration
void IContentSecurityRepository.Delete(string userOrRoleName, SecurityEntityType entityUserRole)
Parameters
Type Name Description
System.String userOrRoleName

Name of the user or role.

SecurityEntityType entityUserRole

The entity user role.

IContentSecurityRepository.Get(ContentReference)

Gets the specified content security descriptor object for the requested content link.

Declaration
IContentSecurityDescriptor IContentSecurityRepository.Get(ContentReference contentLink)
Parameters
Type Name Description
ContentReference contentLink

The content link.

Returns
Type Description
IContentSecurityDescriptor

IContentSecurityRepository.Save(ContentReference, IContentSecurityDescriptor, SecuritySaveType)

Saves the specified content security descriptor.

Declaration
void IContentSecurityRepository.Save(ContentReference contentLink, IContentSecurityDescriptor contentSecurityDescriptor, SecuritySaveType securitySaveType)
Parameters
Type Name Description
ContentReference contentLink

The content link.

IContentSecurityDescriptor contentSecurityDescriptor

The content security descriptor.

SecuritySaveType securitySaveType

Type of the security save.

IContentRepository.ListDelayedPublish()

List all delayed publish contents from all registered content providers

Declaration
IEnumerable<IContent> IContentRepository.ListDelayedPublish()
Returns
Type Description
System.Collections.Generic.IEnumerable<IContent>

A list of all delayed contents from all registered content providers.

Implements

System.IDisposable

Extension Methods

See Also