Partilhar 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)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

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