Try our conversational search powered by Generative AI!

Class IContentExtensions

Extends IContent with some convenient methods.

Inheritance
System.Object
IContentExtensions
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.Core
Assembly: EPiServer.Cms.AspNet.dll
Version: 11.20.7
Syntax
public static class IContentExtensions

Methods

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.