共用方式為


SPField.Update Method (Boolean)

Updates the database with changes that are made to the field and optionally propagates the changes to lists that implement the field.

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

Syntax

'Declaration
<ClientCallableExceptionConstraintAttribute(FixedId := "Update3", ErrorCode := , Condition := "Trying to change UCC from false to true or trying to index the field and the current user does not have permission to do big list operation",  _
    ErrorType := GetType(SPQueryThrottledException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "6", ErrorCode := , Condition := "Trying to change the type of a field which is also changing to be indexed or which is already indexed.",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "7", ErrorCode := , Condition := "Trying to AllowMultipleValues to true to a lookup field which is also changing to be indexed or which is already indexed.",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "FieldCalculatedFormula2", ErrorCode := ,  _
    Condition := "The formula for a FieldCalculated has a syntax error",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "FieldCalculatedFormula3", ErrorCode := ,  _
    Condition := "The formula for a FieldCalculated contains a circular reference",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "FieldCalculatedFormula4", ErrorCode := ,  _
    Condition := "The formula for a FieldCalculated refers to a field whose FieldTypeKind is not allowed in formula",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "5", ErrorCode := , Condition := "Trying to index and set UCC to true to a field and the field has duplicate values in the existing list items.",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "FieldCalculatedFormula7", ErrorCode := ,  _
    Condition := "The formula for a FieldCalculated refers functions or semi-calculated formula",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "FieldType1", ErrorCode := , Condition := "If the field is derived from a built-in field type or the field is referred by another Calculated Field and is not changing to either FieldType.Text, FieldType.Calculated, FieldType.Number, FieldType.Integer, FieldType.Currency, FieldType.DateTime, FieldType.Coice, or FieldType.Boolean or the field type change is not allowed",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "accessdenied", Condition := "User does not have permissions to update this list.",  _
    ErrorType := GetType(UnauthorizedAccessException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "Update2", ErrorCode := , Condition := "Field does not exist",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "Update5", ErrorCode := , Condition := "Total Number of fields in the list exceeds the limit",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "FieldCalculatedFormula5", ErrorCode := ,  _
    Condition := "The formula for a FieldCalculated refers to a field that does not exist",  _
    ErrorType := GetType(SPException))> _
<ClientCallableAttribute(Name := "UpdateAndPushChanges")> _
<ClientCallableExceptionConstraintAttribute(FixedId := "1", ErrorCode := , Condition := "Trying to set UCC property to true for a field which is not indexed",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "2", ErrorCode := , Condition := "Tying to un-index a field which does not allow duplicate values.",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "3", ErrorCode := , Condition := "Trying to change the type of a field which does not allow duplicate values.",  _
    ErrorType := GetType(SPException))> _
<ClientCallableExceptionConstraintAttribute(FixedId := "4", ErrorCode := , Condition := "Trying to change the type of a field to bool where allowing duplicate values in the field is not supported.",  _
    ErrorType := GetType(SPException))> _
Public Sub Update ( _
    pushChangesToLists As Boolean _
)
'Usage
Dim instance As SPField
Dim pushChangesToLists As Boolean

instance.Update(pushChangesToLists)
[ClientCallableExceptionConstraintAttribute(FixedId = "Update3", ErrorCode = , Condition = "Trying to change UCC from false to true or trying to index the field and the current user does not have permission to do big list operation", 
    ErrorType = typeof(SPQueryThrottledException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "6", ErrorCode = , Condition = "Trying to change the type of a field which is also changing to be indexed or which is already indexed.", 
    ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "7", ErrorCode = , Condition = "Trying to AllowMultipleValues to true to a lookup field which is also changing to be indexed or which is already indexed.", 
    ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "FieldCalculatedFormula2", ErrorCode = , 
    Condition = "The formula for a FieldCalculated has a syntax error", 
    ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "FieldCalculatedFormula3", ErrorCode = , 
    Condition = "The formula for a FieldCalculated contains a circular reference", 
    ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "FieldCalculatedFormula4", ErrorCode = , 
    Condition = "The formula for a FieldCalculated refers to a field whose FieldTypeKind is not allowed in formula", 
    ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "5", ErrorCode = , Condition = "Trying to index and set UCC to true to a field and the field has duplicate values in the existing list items.", 
    ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "FieldCalculatedFormula7", ErrorCode = , 
    Condition = "The formula for a FieldCalculated refers functions or semi-calculated formula", 
    ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "FieldType1", ErrorCode = , Condition = "If the field is derived from a built-in field type or the field is referred by another Calculated Field and is not changing to either FieldType.Text, FieldType.Calculated, FieldType.Number, FieldType.Integer, FieldType.Currency, FieldType.DateTime, FieldType.Coice, or FieldType.Boolean or the field type change is not allowed", 
    ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "accessdenied", Condition = "User does not have permissions to update this list.", 
    ErrorType = typeof(UnauthorizedAccessException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "Update2", ErrorCode = , Condition = "Field does not exist", 
    ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "Update5", ErrorCode = , Condition = "Total Number of fields in the list exceeds the limit", 
    ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "FieldCalculatedFormula5", ErrorCode = , 
    Condition = "The formula for a FieldCalculated refers to a field that does not exist", 
    ErrorType = typeof(SPException))]
[ClientCallableAttribute(Name = "UpdateAndPushChanges")]
[ClientCallableExceptionConstraintAttribute(FixedId = "1", ErrorCode = , Condition = "Trying to set UCC property to true for a field which is not indexed", 
    ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "2", ErrorCode = , Condition = "Tying to un-index a field which does not allow duplicate values.", 
    ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "3", ErrorCode = , Condition = "Trying to change the type of a field which does not allow duplicate values.", 
    ErrorType = typeof(SPException))]
[ClientCallableExceptionConstraintAttribute(FixedId = "4", ErrorCode = , Condition = "Trying to change the type of a field to bool where allowing duplicate values in the field is not supported.", 
    ErrorType = typeof(SPException))]
public void Update(
    bool pushChangesToLists
)

Parameters

  • pushChangesToLists
    Type: System.Boolean

    true to propagate changes to lists that implement the field; otherwise, false.

Exceptions

Exception Condition
SPException

An error was encountered during the operation.

See Also

Reference

SPField Class

SPField Members

Update Overload

Microsoft.SharePoint Namespace