共用方式為


SPField.EnforceUniqueValues property

取得或設定 Boolean 值,指定是否要強制執行唯一性的欄值。預設值為false。

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

Syntax

'宣告
Public Property EnforceUniqueValues As Boolean
    Get
    Set
'用途
Dim instance As SPField
Dim value As Boolean

value = instance.EnforceUniqueValues

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

Property value

Type: System.Boolean
會傳回true來強制執行唯一性在指定的資料行中,填入的值否則false。預設值為false。

Exceptions

Exception Condition
SPException

您無法將這個屬性設定為true的內建的欄位或網站欄。

備註

當您將此屬性設定為true時,您也應該以true設定Indexed屬性。

欄位定義中的欄位元素的對等 XML 屬性是AllowDuplicateValues。

請參閱

參照

SPField class

SPField members

Microsoft.SharePoint namespace

其他資源

Enforcing Uniqueness in Column Values