Class ListExtensions
Class that provides generic list creation and manipulation methods
Inheritance
Namespace: Microsoft.SharePoint.Client
Assembly: PnP.Framework.dll
Syntax
public static class ListExtensions : object
Methods
AddIndexedPropertyBagKey(List, String)
Marks a property bag key for indexing
Declaration
public static bool AddIndexedPropertyBagKey(this List list, string key)
Parameters
List
list
The list to process |
System.String
key
The key to mark for indexing |
Returns
System.Boolean
Returns True if succeeded |
AddRemoteEventReceiver(List, String, String, EventReceiverType, EventReceiverSynchronization, Boolean)
Registers a remote event receiver
Declaration
public static EventReceiverDefinition AddRemoteEventReceiver(this List list, string name, string url, EventReceiverType eventReceiverType, EventReceiverSynchronization synchronization, bool force)
Parameters
List
list
The list to process |
System.String
name
The name of the event receiver (needs to be unique among the event receivers registered on this list) |
System.String
url
The URL of the remote WCF service that handles the event |
EventReceiverType
eventReceiverType
|
EventReceiverSynchronization
synchronization
|
System.Boolean
force
If True any event already registered with the same name will be removed first. |
Returns
EventReceiverDefinition
Returns an EventReceiverDefinition if succeeded. Returns null if failed. |
AddRemoteEventReceiver(List, String, String, EventReceiverType, EventReceiverSynchronization, Int32, Boolean)
Registers a remote event receiver
Declaration
public static EventReceiverDefinition AddRemoteEventReceiver(this List list, string name, string url, EventReceiverType eventReceiverType, EventReceiverSynchronization synchronization, int sequenceNumber, bool force)
Parameters
List
list
The list to process |
System.String
name
The name of the event receiver (needs to be unique among the event receivers registered on this list) |
System.String
url
The URL of the remote WCF service that handles the event |
EventReceiverType
eventReceiverType
|
EventReceiverSynchronization
synchronization
|
System.Int32
sequenceNumber
|
System.Boolean
force
If True any event already registered with the same name will be removed first. |
Returns
EventReceiverDefinition
Returns an EventReceiverDefinition if succeeded. Returns null if failed. |
AddWebhookSubscription(List, String, DateTime, String, String)
Add the a Webhook subscription to a list Note: If the access token is not specified, it will cost a dummy request to retrieve it
Declaration
public static WebhookSubscription AddWebhookSubscription(this List list, string notificationUrl, DateTime expirationDate, string clientState = null, string accessToken = null)
Parameters
List
list
The list to add a Webhook subscription to |
System.String
notificationUrl
The Webhook endpoint URL |
DateTime
expirationDate
The expiration date of the subscription |
System.String
clientState
The client state to use in the Webhook subscription |
System.String
accessToken
(optional) The access token to SharePoint |
Returns
WebhookSubscription
The added subscription object |
AddWebhookSubscription(List, String, Int32, String, String)
Add the a Webhook subscription to a list Note: If the access token is not specified, it will cost a dummy request to retrieve it
Declaration
public static WebhookSubscription AddWebhookSubscription(this List list, string notificationUrl, int validityInMonths = 6, string clientState = null, string accessToken = null)
Parameters
List
list
The list to add a Webhook subscription to |
System.String
notificationUrl
The Webhook endpoint URL |
System.Int32
validityInMonths
The validity of the subscriptions in months |
System.String
clientState
The client state to use in the Webhook subscription |
System.String
accessToken
(optional) The access token to SharePoint |
Returns
WebhookSubscription
The added subscription object |
ClearDefaultColumnValues(List)
Remove all default column values that are defined for this list.
Declaration
public static void ClearDefaultColumnValues(this List list)
Parameters
List
list
The list to process. |
ClearDefaultColumnValues(List, IEnumerable<IDefaultColumnValue>)
Removes the provided default column values from the specified folder(s) from list, if they were set.
Declaration
public static void ClearDefaultColumnValues(this List list, IEnumerable<IDefaultColumnValue> columnValues)
Parameters
List
list
The list to process. |
IEnumerable<IDefaultColumnValue>
columnValues
The default column values that must be cleared. |
CreateDocumentLibrary(Web, String, Boolean, String)
Adds a document library to a web. Execute Query is called during this implementation
Declaration
public static List CreateDocumentLibrary(this Web web, string listName, bool enableVersioning = false, string urlPath = "")
Parameters
Web
web
Site to be processed - can be root web or sub site |
System.String
listName
Name of the library |
System.Boolean
enableVersioning
Enable versioning on the list |
System.String
urlPath
Path of the url |
Returns
List
|
CreateList(Web, Guid, Int32, String, Boolean, Boolean, String, Boolean)
Adds a custom list to a site
Declaration
public static List CreateList(this Web web, Guid featureId, int listType, string listName, bool enableVersioning, bool updateAndExecuteQuery = true, string urlPath = "", bool enableContentTypes = false)
Parameters
Web
web
Site to be processed - can be root web or sub site |
Guid
featureId
Feature that contains the list template |
System.Int32
listType
Type ID of the list, within the feature |
System.String
listName
Name of the list |
System.Boolean
enableVersioning
Enable versioning on the list |
System.Boolean
updateAndExecuteQuery
(Optional) Perform list update and executequery, defaults to true |
System.String
urlPath
(Optional) URL to use for the list |
System.Boolean
enableContentTypes
(Optional) Enable content type management |
Returns
List
The newly created list |
CreateList(Web, ListTemplateType, String, Boolean, Boolean, String, Boolean, Boolean)
Adds a default list to a site
Declaration
public static List CreateList(this Web web, ListTemplateType listType, string listName, bool enableVersioning, bool updateAndExecuteQuery = true, string urlPath = "", bool enableContentTypes = false, bool hidden = false)
Parameters
Web
web
Site to be processed - can be root web or sub site |
ListTemplateType
listType
Built in list template type |
System.String
listName
Name of the list |
System.Boolean
enableVersioning
Enable versioning on the list |
System.Boolean
updateAndExecuteQuery
(Optional) Perform list update and executequery, defaults to true |
System.String
urlPath
(Optional) URL to use for the list |
System.Boolean
enableContentTypes
(Optional) Enable content type management |
System.Boolean
hidden
(Optional) Hide the list from the SharePoint UI |
Returns
List
The newly created list |
CreateView(List, String, ViewType, String[], UInt32, Boolean, String, Boolean, Boolean)
Create view to existing list
Declaration
public static View CreateView(this List list, string viewName, ViewType viewType, string[] viewFields, uint rowLimit, bool setAsDefault, string query = null, bool personal = false, bool paged = false)
Parameters
List
list
List to process |
System.String
viewName
Name of the view |
ViewType
viewType
Type of the view |
System.String[]
viewFields
Fields of the view |
System.UInt32
rowLimit
Row limit of the view |
System.Boolean
setAsDefault
Set as default view |
System.String
query
Query for view creation |
System.Boolean
personal
Personal View |
System.Boolean
paged
Paged view |
Returns
View
|
CreateViewsFromXML(List, XmlDocument)
Actual implementation of the view creation logic based on given xml
Declaration
public static void CreateViewsFromXML(this List list, XmlDocument xmlDoc)
Parameters
List
list
List to process |
XmlDocument
xmlDoc
XmlDocument object |
CreateViewsFromXML(Web, String, XmlDocument)
Create list views based on xml structure loaded to memory
Declaration
public static void CreateViewsFromXML(this Web web, string listUrl, XmlDocument xmlDoc)
Parameters
Web
web
Web to process |
System.String
listUrl
List Url |
XmlDocument
xmlDoc
XmlDocument object |
CreateViewsFromXMLFile(List, String)
Create list views based on specific xml structure in external file
Declaration
public static void CreateViewsFromXMLFile(this List list, string filePath)
Parameters
List
list
List to process |
System.String
filePath
Path of the file |
CreateViewsFromXMLFile(Web, String, String)
Creates list views based on specific xml structure from file
Declaration
public static void CreateViewsFromXMLFile(this Web web, string listUrl, string filePath)
Parameters
Web
web
Web to process |
System.String
listUrl
List Url |
System.String
filePath
Path of the file |
CreateViewsFromXMLString(List, String)
Create list views based on specific xml structure in string
Declaration
public static void CreateViewsFromXMLString(this List list, string xmlString)
Parameters
List
list
List to process |
System.String
xmlString
XML string to create view |
CreateViewsFromXMLString(Web, String, String)
Creates views based on specific xml structure from string
Declaration
public static void CreateViewsFromXMLString(this Web web, string listUrl, string xmlString)
Parameters
Web
web
Web to process |
System.String
listUrl
List Url |
System.String
xmlString
Path of the file |
EnableClassicAudienceTargeting(List)
Enable Classic Audience Targeting on a List
Declaration
public static void EnableClassicAudienceTargeting(this List list)
Parameters
List
list
|
EnableModernAudienceTargeting(List)
Declaration
public static void EnableModernAudienceTargeting(this List list)
Parameters
List
list
|
GetDefaultColumnValues(List)
Gets default values for column values.
The returned list contains one dictionary per default setting per folder.
Each dictionary has the following keys set: Path, Field, Value
Path: Relative path to the library/folder
Field: Internal name of the field which has a default value
Value: The default value for the field
Declaration
public static List<Dictionary<string, string>> GetDefaultColumnValues(this List list)
Parameters
List
list
List to process |
Returns
List<Dictionary<System.String, System.String>>
|
GetEventReceiverById(List, Guid)
Returns an event receiver definition
Declaration
public static EventReceiverDefinition GetEventReceiverById(this List list, Guid id)
Parameters
List
list
The target list |
Guid
id
Id of the event receiver |
Returns
EventReceiverDefinition
|
GetEventReceiverByName(List, String)
Returns an event receiver definition
Declaration
public static EventReceiverDefinition GetEventReceiverByName(this List list, string name)
Parameters
List
list
The list to process |
System.String
name
Name of the event receiver |
Returns
EventReceiverDefinition
|
GetIndexedPropertyBagKeys(List)
Returns all keys in the property bag that have been marked for indexing
Declaration
public static IEnumerable<string> GetIndexedPropertyBagKeys(this List list)
Parameters
List
list
The list to process |
Returns
IEnumerable<System.String>
all indexed property bag keys |
GetListById(Web, Guid, Expression<Func<List, Object>>[])
Get List by using Id
Declaration
public static List GetListById(this Web web, Guid listId, params Expression<Func<List, object>>[] expressions)
Parameters
Web
web
The web containing the list |
Guid
listId
The Id of the list |
Expression<Func<List, System.Object>>[]
expressions
Additional list of lambda expressions of properties to load alike l => l.BaseType |
Returns
List
Loaded list instance matching specified Id |
GetListByTitle(Web, String, Expression<Func<List, Object>>[])
Get list by using Title
Declaration
public static List GetListByTitle(this Web web, string listTitle, params Expression<Func<List, object>>[] expressions)
Parameters
Web
web
Site to be processed - can be root web or sub site |
System.String
listTitle
Title of the list to return |
Expression<Func<List, System.Object>>[]
expressions
Additional list of lambda expressions of properties to load alike l => l.BaseType |
Returns
List
Loaded list instance matching to title or null |
GetListByUrl(Web, String, Expression<Func<List, Object>>[])
Get list by using Url
Declaration
public static List GetListByUrl(this Web web, string webRelativeUrl, params Expression<Func<List, object>>[] expressions)
Parameters
Web
web
Web (site) to be processed |
System.String
webRelativeUrl
Url of list relative to the web (site), e.g. lists/testlist |
Expression<Func<List, System.Object>>[]
expressions
Additional list of lambda expressions of properties to load alike l => l.BaseType |
Returns
List
Returns list if found, null if no list is found. |
GetListID(Web, String)
Returns the GUID id of a list
Declaration
public static Guid GetListID(this Web web, string listName)
Parameters
Web
web
Site to be processed - can be root web or sub site |
System.String
listName
List to operate on |
Returns
Guid
|
GetPagesLibrary(Web)
Gets the publishing pages library of the web based on site language
Declaration
public static List GetPagesLibrary(this Web web)
Parameters
Web
web
The web. |
Returns
List
The publishing pages library. Returns null if library was not found. |
GetPropertyBagValueDateTime(List, String, DateTime)
Get DateTime typed property bag value. If does not contain, returns default value.
Declaration
public static DateTime? GetPropertyBagValueDateTime(this List list, string key, DateTime defaultValue)
Parameters
List
list
The list to process |
System.String
key
Key of the property bag entry to return |
DateTime
defaultValue
|
Returns
System.Nullable<DateTime>
Value of the property bag entry as integer |
GetPropertyBagValueInt(List, String, Int32)
Get int typed property bag value. If does not contain, returns default value.
Declaration
public static int? GetPropertyBagValueInt(this List list, string key, int defaultValue)
Parameters
List
list
List to read the property bag value from |
System.String
key
Key of the property bag entry to return |
System.Int32
defaultValue
Default value of the property bag |
Returns
System.Nullable<System.Int32>
Value of the property bag entry as integer |
GetPropertyBagValueString(List, String, String)
Get string typed property bag value. If does not contain, returns given default value.
Declaration
public static string GetPropertyBagValueString(this List list, string key, string defaultValue)
Parameters
List
list
List to read the property bag value from |
System.String
key
Key of the property bag entry to return |
System.String
defaultValue
Default value of the property bag |
Returns
System.String
Value of the property bag entry as string |
GetViewById(List, Guid, Expression<Func<View, Object>>[])
Gets a view by Id
Declaration
public static View GetViewById(this List list, Guid id, params Expression<Func<View, object>>[] expressions)
Parameters
List
list
List to process |
Guid
id
Id to the view to extract |
Expression<Func<View, System.Object>>[]
expressions
List of lambda expressions of properties to load when retrieving the object |
Returns
View
returns null if not found |
GetViewByName(List, String, Expression<Func<View, Object>>[])
Gets a view by Name
Declaration
public static View GetViewByName(this List list, string name, params Expression<Func<View, object>>[] expressions)
Parameters
List
list
List to process |
System.String
name
Name of the view |
Expression<Func<View, System.Object>>[]
expressions
List of lambda expressions of properties to load when retrieving the object |
Returns
View
returns null if not found |
GetWebhookSubscriptions(List, String)
Get all the existing Webhooks subscriptions of the list Note: If the access token is not specified, it will cost a dummy request to retrieve it
Declaration
public static IList<WebhookSubscription> GetWebhookSubscriptions(this List list, string accessToken = null)
Parameters
List
list
The list to get the subscriptions of |
System.String
accessToken
(optional) The access token to SharePoint |
Returns
IList<WebhookSubscription>
The collection of Webhooks subscriptions of the list |
GetWebhookSubscriptionsAsync(List, String)
Async get all the existing Webhooks subscriptions of the list Note: If the access token is not specified, it will cost a dummy request to retrieve it
Declaration
public static async Task<IList<WebhookSubscription>> GetWebhookSubscriptionsAsync(this List list, string accessToken = null)
Parameters
List
list
The list to get the subscriptions of |
System.String
accessToken
(optional) The access token to SharePoint |
Returns
Task<IList<WebhookSubscription>>
The collection of Webhooks subscriptions of the list |
GetWebRelativeUrl(List)
Gets the web relative URL.
Allow users to get the web relative URL of a list.
This is useful when exporting lists as it can then be used as a parameter to Web.GetListByUrl().
Declaration
public static string GetWebRelativeUrl(this List list)
Parameters
List
list
The list to export the URL of. |
Returns
System.String
The web relative URL of the list. |
IsCreatedFromTemplate(List)
Declaration
public static bool IsCreatedFromTemplate(this List list)
Parameters
List
list
|
Returns
System.Boolean
|
ListExists(Web, Guid)
Checks if list exists on the particular site based on the list id property.
Declaration
public static bool ListExists(this Web web, Guid id)
Parameters
Web
web
Site to be processed - can be root web or sub site |
Guid
id
The id of the list to be checked. |
Returns
System.Boolean
True if the list exists |
ListExists(Web, String)
Checks if list exists on the particular site based on the list Title property.
Declaration
public static bool ListExists(this Web web, string listTitle)
Parameters
Web
web
Site to be processed - can be root web or sub site |
System.String
listTitle
Title of the list to be checked. |
Returns
System.Boolean
True if the list exists |
ListExists(Web, Uri)
Checks if list exists on the particular site based on the list's site relative path.
Declaration
public static bool ListExists(this Web web, Uri siteRelativeUrlPath)
Parameters
Web
web
Site to be processed - can be root web or sub site |
Uri
siteRelativeUrlPath
Site relative path of the list |
Returns
System.Boolean
True if the list exists |
PropertyBagContainsKey(List, String)
Checks if the given property bag entry exists
Declaration
public static bool PropertyBagContainsKey(this List list, string key)
Parameters
List
list
List to be processed |
System.String
key
Key of the property bag entry to check |
Returns
System.Boolean
True if the entry exists, false otherwise |
ReIndexList(List)
Queues a list for a full crawl the next incremental crawl
Declaration
public static void ReIndexList(this List list)
Parameters
List
list
List to process |
RemoveContentTypeByName(List, String)
Removes a content type from a list/library by name
Declaration
public static void RemoveContentTypeByName(this List list, string contentTypeName)
Parameters
List
list
The list |
System.String
contentTypeName
The content type name to remove from the list |
RemoveIndexedPropertyBagKey(List, String)
Unmarks a property bag key for indexing
Declaration
public static bool RemoveIndexedPropertyBagKey(this List list, string key)
Parameters
List
list
The list to process |
System.String
key
The key to unmark for indexed. Case-sensitive |
Returns
System.Boolean
Returns True if succeeded |
RemovePropertyBagValue(List, String)
Removes a property bag value from the property bag
Declaration
public static void RemovePropertyBagValue(this List list, string key)
Parameters
List
list
The list to process |
System.String
key
The key to remove |
RemoveWebhookSubscription(List, Guid, String)
Remove a Webhook subscription from the list Note: If the access token is not specified, it will cost a dummy request to retrieve it
Declaration
public static bool RemoveWebhookSubscription(this List list, Guid subscriptionId, string accessToken = null)
Parameters
List
list
The list to remove the Webhook subscription from |
Guid
subscriptionId
The id of the subscription to remove |
System.String
accessToken
(optional) The access token to SharePoint |
Returns
System.Boolean
|
RemoveWebhookSubscription(List, WebhookSubscription, String)
Remove a Webhook subscription from the list Note: If the access token is not specified, it will cost a dummy request to retrieve it
Declaration
public static bool RemoveWebhookSubscription(this List list, WebhookSubscription subscription, string accessToken = null)
Parameters
List
list
The list to remove the Webhook subscription from |
WebhookSubscription
subscription
The subscription to remove |
System.String
accessToken
(optional) The access token to SharePoint |
Returns
System.Boolean
|
RemoveWebhookSubscription(List, String, String)
Remove a Webhook subscription from the list Note: If the access token is not specified, it will cost a dummy request to retrieve it
Declaration
public static bool RemoveWebhookSubscription(this List list, string subscriptionId, string accessToken = null)
Parameters
List
list
The list to remove the Webhook subscription from |
System.String
subscriptionId
The id of the subscription to remove |
System.String
accessToken
(optional) The access token to SharePoint |
Returns
System.Boolean
|
SetDefaultColumnValues(List, IEnumerable<IDefaultColumnValue>)
Sets default values for column values.
In order to for instance set the default Enterprise Metadata keyword field to a term, add the enterprise metadata keyword to a library (internal name "TaxKeyword")
Column values are defined by the DefaultColumnValue class that has 3 properties:
RelativeFolderPath : / to set a default value for the root of the document library, or /foldername to specify a subfolder
FieldInternalName : The name of the field to set. For instance "TaxKeyword" to set the Enterprise Metadata field
Terms : A collection of Taxonomy terms to set
Supported column types: Metadata, Text, Choice, MultiChoice, People, Boolean, DateTime, Number, Currency
Declaration
public static void SetDefaultColumnValues(this List list, IEnumerable<IDefaultColumnValue> columnValues)
Parameters
List
list
List to process |
IEnumerable<IDefaultColumnValue>
columnValues
Column Values |
SetDefaultColumnValues(List, IEnumerable<IDefaultColumnValue>, Boolean)
Sets default values for column values.
In order to for instance set the default Enterprise Metadata keyword field to a term, add the enterprise metadata keyword to a library (internal name "TaxKeyword")
Column values are defined by the DefaultColumnValue class that has 3 properties:
RelativeFolderPath : / to set a default value for the root of the document library, or /foldername to specify a subfolder
FieldInternalName : The name of the field to set. For instance "TaxKeyword" to set the Enterprise Metadata field
Terms : A collection of Taxonomy terms to set
Supported column types: Metadata, Text, Choice, MultiChoice, People, Boolean, DateTime, Number, Currency
Declaration
public static void SetDefaultColumnValues(this List list, IEnumerable<IDefaultColumnValue> columnValues, bool overwriteExistingDefaultColumnValues)
Parameters
List
list
The list to process. |
IEnumerable<IDefaultColumnValue>
columnValues
The default column values. |
System.Boolean
overwriteExistingDefaultColumnValues
If true, the currrent default column values will be overwritten. |
SetJSLinkCustomizations(List, PageType, String)
Sets JS link customization for a list form
Declaration
public static void SetJSLinkCustomizations(this List list, PageType pageType, string jslink)
Parameters
List
list
SharePoint list |
PageType
pageType
Type of form |
System.String
jslink
JSLink to set to the form. Set to empty string to remove the set JSLink customization. Specify multiple values separated by pipe symbol. For e.g.: ~sitecollection/_catalogs/masterpage/jquery-2.1.0.min.js|~sitecollection/_catalogs/masterpage/custom.js |
SetJSLinkCustomizations(List, String, String)
Sets JS link customization for a list view page
Declaration
public static void SetJSLinkCustomizations(this List list, string serverRelativeUrl, string jslink)
Parameters
List
list
SharePoint list |
System.String
serverRelativeUrl
url of the view page |
System.String
jslink
JSLink to set to the form. Set to empty string to remove the set JSLink customization. Specify multiple values separated by pipe symbol. For e.g.: ~sitecollection/_catalogs/masterpage/jquery-2.1.0.min.js|~sitecollection/_catalogs/masterpage/custom.js |
SetListPermission(List, BuiltInIdentity, RoleType)
Set custom permission to the list
Declaration
public static void SetListPermission(this List list, BuiltInIdentity user, RoleType roleType)
Parameters
List
list
List on which permission to be set |
BuiltInIdentity
user
Built in user |
RoleType
roleType
Role type |
SetListPermission(List, Principal, RoleType)
Set custom permission to the list
Declaration
public static void SetListPermission(this List list, Principal principal, RoleType roleType)
Parameters
List
list
List on which permission to be set |
Principal
principal
SharePoint Group or User |
RoleType
roleType
Role type |
SetLocalizationLabelsForList(List, String, String, String)
Can be used to set translations for different cultures.
Declaration
public static void SetLocalizationLabelsForList(this List list, string cultureName, string titleResource, string descriptionResource)
Parameters
List
list
List to be processed |
System.String
cultureName
Culture name like en-us or fi-fi |
System.String
titleResource
Localized Title string |
System.String
descriptionResource
Localized Description string |
Examples
list.SetLocalizationForSiteLabels("fi-fi", "Name of the site in Finnish", "Description in Finnish");
SetLocalizationLabelsForList(Web, String, String, String, String)
Can be used to set translations for different cultures. http://blogs.msdn.com/b/vesku/archive/2014/03/20/office365-multilingual-content-types-site-columns-and-site-other-elements.aspx
Declaration
public static void SetLocalizationLabelsForList(this Web web, string listTitle, string cultureName, string titleResource, string descriptionResource)
Parameters
Web
web
Site to be processed - can be root web or sub site |
System.String
listTitle
Title of the list |
System.String
cultureName
Culture name like en-us or fi-fi |
System.String
titleResource
Localized Title string |
System.String
descriptionResource
Localized Description string |
SetPropertyBagValue(List, String, DateTime)
Sets a key/value pair in the list property bag
Declaration
public static void SetPropertyBagValue(this List list, string key, DateTime value)
Parameters
List
list
The list to process |
System.String
key
Key for the property bag entry |
DateTime
value
Datetime value for the property bag entry |
SetPropertyBagValue(List, String, Int32)
Sets a key/value pair in the list property bag
Declaration
public static void SetPropertyBagValue(this List list, string key, int value)
Parameters
List
list
The list to process |
System.String
key
Key for the property bag entry |
System.Int32
value
Integer value for the property bag entry |
SetPropertyBagValue(List, String, String)
Sets a key/value pair in the list property bag
Declaration
public static void SetPropertyBagValue(this List list, string key, string value)
Parameters
List
list
List that will hold the property bag entry |
System.String
key
Key for the property bag entry |
System.String
value
String value for the property bag entry |
UpdateListVersioning(List, Boolean, Boolean, Boolean)
Enable/disable versioning on a list
Declaration
public static void UpdateListVersioning(this List list, bool enableVersioning, bool enableMinorVersioning = true, bool updateAndExecuteQuery = true)
Parameters
List
list
List to be processed |
System.Boolean
enableVersioning
True to enable versioning, false to disable |
System.Boolean
enableMinorVersioning
Enable/Disable minor versioning |
System.Boolean
updateAndExecuteQuery
Perform list update and executequery, defaults to true |
UpdateListVersioning(Web, String, Boolean, Boolean, Boolean)
Enable/disable versioning on a list
Declaration
public static void UpdateListVersioning(this Web web, string listName, bool enableVersioning, bool enableMinorVersioning = true, bool updateAndExecuteQuery = true)
Parameters
Web
web
Site to be processed - can be root web or sub site |
System.String
listName
List to operate on |
System.Boolean
enableVersioning
True to enable versioning, false to disable |
System.Boolean
enableMinorVersioning
Enable/Disable minor versioning |
System.Boolean
updateAndExecuteQuery
Perform list update and executequery, defaults to true |
UpdateTaxonomyFieldDefaultValue(Web, String, String, Guid, Boolean)
Sets the default value for a managed metadata column in the specified list. This operation will not change existing items in the list.
Declaration
public static void UpdateTaxonomyFieldDefaultValue(this Web web, string listName, string fieldInternalName, Guid termGuid, bool systemUpdate = false)
Parameters
Web
web
Extension web |
System.String
listName
Name of list which contains the managed metadata field of which the default needs to be set |
System.String
fieldInternalName
Internal name of the managed metadata field for which the default needs to be set |
Guid
termGuid
Term Guid of the Term which represents the managed metadata item which should be set as the default |
System.Boolean
systemUpdate
If set to true, will do a system udpate to the item. Default value is false. |
UpdateTaxonomyFieldDefaultValue(Web, String, String, String, Guid, Guid, Boolean)
Sets the default value for a managed metadata column in the specified list. This operation will not change existing items in the list.
Declaration
public static void UpdateTaxonomyFieldDefaultValue(this Web web, string termName, string listName, string fieldInternalName, Guid groupGuid, Guid termSetGuid, bool systemUpdate = false)
Parameters
Web
web
Extension web |
System.String
termName
Name of a specific term which should be set as the default on the managed metadata field |
System.String
listName
Name of list which contains the managed metadata field of which the default needs to be set |
System.String
fieldInternalName
Internal name of the managed metadata field for which the default needs to be set |
Guid
groupGuid
TermGroup Guid of the Term Group which contains the managed metadata item which should be set as the default |
Guid
termSetGuid
TermSet Guid of the Term Set which contains the managed metadata item which should be set as the default |
System.Boolean
systemUpdate
If set to true, will do a system udpate to the item. Default value is false. |
UpdateTaxonomyFieldDefaultValue(Web, String, String, Term, Boolean)
Sets the default value for a managed metadata column in the specified list. This operation will not change existing items in the list.
Declaration
public static void UpdateTaxonomyFieldDefaultValue(this Web web, string listName, string fieldInternalName, Term term, bool systemUpdate = false)
Parameters
Web
web
Extension web |
System.String
listName
Name of list which contains the managed metadata field of which the default needs to be set |
System.String
fieldInternalName
Internal name of the managed metadata field for which the default needs to be set |
Term
term
Managed metadata Term which represents the managed metadata item which should be set as the default |
System.Boolean
systemUpdate
If set to true, will do a system udpate to the item. Default value is false. |
UpdateWebhookSubscription(List, Guid, DateTime, String)
Updates a Webhook subscription from the list Note: If the access token is not specified, it will cost a dummy request to retrieve it
Declaration
public static bool UpdateWebhookSubscription(this List list, Guid subscriptionId, DateTime expirationDateTime, string accessToken = null)
Parameters
List
list
The list to remove the Webhook subscription from |
Guid
subscriptionId
The id of the subscription to remove |
DateTime
expirationDateTime
New web hook expiration date |
System.String
accessToken
(optional) The access token to SharePoint |
Returns
System.Boolean
|
UpdateWebhookSubscription(List, Guid, String, DateTime, String)
Updates a Webhook subscription from the list Note: If the access token is not specified, it will cost a dummy request to retrieve it
Declaration
public static bool UpdateWebhookSubscription(this List list, Guid subscriptionId, string webHookEndPoint, DateTime expirationDateTime, string accessToken = null)
Parameters
List
list
The list to remove the Webhook subscription from |
Guid
subscriptionId
The id of the subscription to remove |
System.String
webHookEndPoint
Url of the web hook service endpoint (the one that will be called during an event) |
DateTime
expirationDateTime
New web hook expiration date |
System.String
accessToken
(optional) The access token to SharePoint |
Returns
System.Boolean
|
UpdateWebhookSubscription(List, WebhookSubscription, String)
Updates a Webhook subscription from the list Note: If the access token is not specified, it will cost a dummy request to retrieve it
Declaration
public static bool UpdateWebhookSubscription(this List list, WebhookSubscription subscription, string accessToken = null)
Parameters
List
list
The list to remove the Webhook subscription from |
WebhookSubscription
subscription
The subscription to update |
System.String
accessToken
(optional) The access token to SharePoint |
Returns
System.Boolean
|
UpdateWebhookSubscription(List, String, String, DateTime, String)
Updates a Webhook subscription from the list Note: If the access token is not specified, it will cost a dummy request to retrieve it
Declaration
public static bool UpdateWebhookSubscription(this List list, string subscriptionId, string webHookEndPoint, DateTime expirationDateTime, string accessToken = null)
Parameters
List
list
The list to remove the Webhook subscription from |
System.String
subscriptionId
The id of the subscription to remove |
System.String
webHookEndPoint
Url of the web hook service endpoint (the one that will be called during an event) |
DateTime
expirationDateTime
New web hook expiration date |
System.String
accessToken
(optional) The access token to SharePoint |
Returns
System.Boolean
|