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