Interface IContentRepository

Defines repository methods for IContent objects.

Namespace: EPiServer
Assembly: EPiServer.dll
Version: 11.20.7
Syntax
public interface IContentRepository : IContentLoader

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
ContentReference Copy(ContentReference source, ContentReference destination, AccessLevel requiredSourceAccess, AccessLevel requiredDestinationAccess, bool publishOnDestination)
Parameters
Type Name Description
ContentReference source

The content that should be copied.

ContentReference destination

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.

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 content.

Remarks

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

CreateLanguageBranch<T>(ContentReference, CultureInfo)

Creates a new language branch for a content item in the specified language.

Declaration
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 IContent 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 content from the repository first ensuring that the current user meets the minimal access right requirements.

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

The content link.

System.Boolean forceDelete

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

AccessLevel access

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

DeleteChildren(ContentReference, Boolean, AccessLevel)

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

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

The content link.

System.Boolean forceDelete

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

AccessLevel access

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

DeleteLanguageBranch(ContentReference, String, AccessLevel)

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

Declaration
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.

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.

Declaration
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 doesn't have access right to perform this action

GetDefault<T>(ContentReference, CultureInfo)

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 language.

Declaration
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
AccessDeniedException

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

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.

Declaration
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, CultureInfo)

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 language.

Declaration
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 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

GetLanguageBranches<T>(ContentReference)

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

Declaration
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 IContent for all language branches.

Type Parameters
Name Description
T

GetReferencesToContent(ContentReference, Boolean)

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

Declaration
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 descendants is also checked.

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

ListDelayedPublish()

Lists all content that are set to delayed publish.

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

All matching content Versions

Move(ContentReference, ContentReference, AccessLevel, AccessLevel)

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

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

The content that should be moved.

ContentReference destination

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

AccessLevel requiredSourceAccess

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

AccessLevel requiredDestinationAccess

The minimal access rights required on the destination.

Returns
Type Description
ContentReference

A ContentReference to the moved content.

MoveToWastebasket(ContentReference, String)

Moves a page to the wastebasket.

Declaration
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.

Save(IContent, SaveAction, AccessLevel)

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

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

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

SaveAction action

The exact SaveAction that should be performed.

AccessLevel access

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

Returns
Type Description
ContentReference

A ContentReference to the saved content.

Extension Methods