Compartilhar via


SPList.ValidationMessage Property

Gets or sets the message that is displayed when validation fails for a list item.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online

Syntax

'Declaration
<ClientCallableConstraintAttribute(Type := ClientCallableConstraintType.MaxLength, Value := , Sequence := )> _
<ClientCallableConstraintAttribute(Type := ClientCallableConstraintType.NotNull, Sequence := )> _
<ClientCallablePropertyAttribute(ExcludeFromDefaultRetrieve := True)> _
Public Property ValidationMessage As String
    Get
    Set
'Usage
Dim instance As SPList
Dim value As String

value = instance.ValidationMessage

instance.ValidationMessage = value
[ClientCallableConstraintAttribute(Type = ClientCallableConstraintType.MaxLength, Value = , Sequence = )]
[ClientCallableConstraintAttribute(Type = ClientCallableConstraintType.NotNull, Sequence = )]
[ClientCallablePropertyAttribute(ExcludeFromDefaultRetrieve = true)]
public string ValidationMessage { get; set; }

Property Value

Type: System.String
The text of the message.

Exceptions

Exception Condition
ArgumentException

The string is too long. The maximum length of a validation message string is 1024.

Remarks

Each time that a list item is added or updated, the validation formula contained in the ValidationFormula property is evaluated. If validation fails, the message in the ValidationMessage property is displayed.

See Also

Reference

SPList Class

SPList Members

Microsoft.SharePoint Namespace

ValidationFormula