Share via


SPList.EnforceDataValidation property

Gets or sets a value that indicates whether certain field properties are enforced when an item is added or updated.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

Syntax

'Declaration
Public Property EnforceDataValidation As Boolean
    Get
    Set
'Usage
Dim instance As SPList
Dim value As Boolean

value = instance.EnforceDataValidation

instance.EnforceDataValidation = value
public bool EnforceDataValidation { get; set; }

Property value

Type: System.Boolean
true to enforce field properties; otherwise, false.

Remarks

If the value of the EnforceDataValidation property is true, then the following conditions must be met:

  • If the Required property of any field in the item is set to true, then the field must have a value.

  • If an SPFieldNumber object in the item has values in the MinimumValue and MaximumValue properties, then the field value must be within the specified bounds.

  • If an SPFieldChoice object in the item has the FillInChoice property set to true, then the field value must be one of the strings in the field's Choices collection.

If any one of these conditions is not met, then an SPListDataValidationException is thrown.

Note

The type of validation controlled by this property is independent of validation that uses the formula set in the ValidationFormula property.

See also

Reference

SPList class

SPList members

Microsoft.SharePoint namespace