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

Class IContentExtensions

Extends IContent with some convenient methods.

Inheritance
System.Object
IContentExtensions
Namespace: EPiServer.Core
Assembly: EPiServer.Cms.AspNetCore.dll
Version: 12.0.3
Syntax
public static class IContentExtensions : Object

Methods

IsPropertyEditableInCurrentLanguage(IContentData, String, Boolean)

Determines if the property is editable in the current language

Declaration
public static bool IsPropertyEditableInCurrentLanguage(this IContentData content, string propertyName, bool allowMetaDataMappings = false)
Parameters
Type Name Description
IContentData content
System.String propertyName
System.Boolean allowMetaDataMappings
Returns
Type Description
System.Boolean

QueryAccess(IContent)

Return the access level that the current user has to the content

Declaration
public static AccessLevel QueryAccess(this IContent content)
Parameters
Type Name Description
IContent content

The content.

Returns
Type Description
AccessLevel

An AccessLevel

Remarks

Note that this method also checks the published status of the page to determine the actual access that the user has. I e if the page is not published the user will not see it unless he has "more" access than Read.

QueryDistinctAccess(IContent, AccessLevel)

Check for a distinct required access level. This is preferred to use over QueryAccess for performance reasons.

Declaration
public static bool QueryDistinctAccess(this IContent content, AccessLevel requestedLevel)
Parameters
Type Name Description
IContent content

The content.

AccessLevel requestedLevel

The requested level.

Returns
Type Description
System.Boolean

true if at least the requested access is held by the current user

Remarks

This method is optimized for speed, by checking preconditions before calling expensive methods.