Class ListItemExtensions
Extension methods for the ListItem object
Inheritance
System.Object
ListItemExtensions
Assembly: PnP.Framework.dll
Syntax
public static class ListItemExtensions : object
Methods
Gets the page audience(s)
Declaration
public static AudienceEntity Audiences(this ListItem item)
Parameters
ListItem
item
Page list item
|
Returns
Checks if a listitem contains a field
Declaration
public static bool FieldExists(this ListItem item, string fieldName)
Parameters
ListItem
item
List item to check
|
System.String
fieldName
Name of the field to check
|
Returns
Checks if a listitem contains a field with a value
Declaration
public static bool FieldExistsAndUsed(this ListItem item, string fieldName)
Parameters
ListItem
item
List item to check
|
System.String
fieldName
Name of the field to check
|
Returns
Gets the field value (if the field exists and a value is set) in the given type
Declaration
public static T GetFieldValueAs<T>(this ListItem item, string fieldName)
Parameters
ListItem
item
List item to get the field from
|
System.String
fieldName
Name of the field to get the value from
|
Returns
T
Value of the field in the requested type or null if unable to cast
|
Type Parameters
T
Type to get the fieldValue in
|
Gets the page last modified by
Declaration
public static string LastModifiedBy(this ListItem item)
Parameters
ListItem
item
Page list item
|
Returns
System.String
Last modified by user/account
|
Gets the page last modified date time
Declaration
public static DateTime LastModifiedDateTime(this ListItem item)
Parameters
ListItem
item
Page list item
|
Returns
DateTime
DateTime of the last modification
|
Gets the blog last published date time
Declaration
public static DateTime LastPublishedDateTime(this ListItem item)
Parameters
ListItem
item
Page list item
|
Returns
DateTime
DateTime of the last modification
|
Gets the page page layout
Declaration
public static string PageLayout(this ListItem item)
Parameters
ListItem
item
Page list item
|
Returns
System.String
Page layout defined for this page
|
Gets the page page layout file
Declaration
public static string PageLayoutFile(this ListItem item)
Parameters
ListItem
item
Page list item
|
Returns
System.String
Page layout file defined for this page
|
Determines the type of page
Declaration
public static string PageType(this ListItem item)
Parameters
ListItem
item
Page list item
|
Returns
System.String
Type of page
|
Transforms a classic wiki/webpart page into a modern page, using the default page transformation model (webpartmapping.xml)
Declaration
public static void Transform(this ListItem sourcePage, PageTransformationInformation pageTransformationInformation)
Parameters
ListItem
sourcePage
ListItem for the classic wiki/webpart page
|
PageTransformationInformation
pageTransformationInformation
Information to drive the page transformation process
|
Transforms a classic wiki/webpart page into a modern page using a custom transformation model
Declaration
public static void Transform(this ListItem sourcePage, PageTransformationInformation pageTransformationInformation, string pageTransformationFile)
Parameters
ListItem
sourcePage
ListItem for the classic wiki/webpart page
|
PageTransformationInformation
pageTransformationInformation
Information to drive the page transformation process
|
System.String
pageTransformationFile
Page transformation model to be used
|
Gets the web part information from the page
Declaration
public static Tuple<PageLayout, List<WebPartEntity>> WebParts(this ListItem item, PageTransformation pageTransformation)
Parameters
ListItem
item
Page list item
|
PageTransformation
pageTransformation
PageTransformation model loaded from XML
|
Returns