共用方式為


SPField.Required Property

Gets or sets a Boolean value that determines whether users must enter a value for the field on New and Edit forms.

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

Syntax

'Declaration
<ClientCallableAttribute> _
Public Property Required As Boolean
    Get
    Set
'Usage
Dim instance As SPField
Dim value As Boolean

value = instance.Required

instance.Required = value
[ClientCallableAttribute]
public bool Required { get; set; }

Property Value

Type: System.Boolean
true if the field requires values; otherwise, false.

Exceptions

Exception Condition
NotSupportedException

The list that the field belongs to is an external list.

See Also

Reference

SPField Class

SPField Members

Microsoft.SharePoint Namespace