MetadataDefaults.RemoveFieldDefault Method (String, String)

Removes the default value of a field from an SPFolder object.

Namespace:  Microsoft.Office.DocumentManagement
Assembly:  Microsoft.Office.DocumentManagement (in Microsoft.Office.DocumentManagement.dll)

Syntax

'Declaration
Public Function RemoveFieldDefault ( _
    folderPath As String, _
    fieldName As String _
) As Boolean
'Usage
Dim instance As MetadataDefaults
Dim folderPath As String
Dim fieldName As String
Dim returnValue As Boolean

returnValue = instance.RemoveFieldDefault(folderPath, _
    fieldName)
public bool RemoveFieldDefault(
    string folderPath,
    string fieldName
)

Parameters

  • folderPath
    Type: System.String

    The server-relative path that links to the SPFolder object from which to remove the default value.

  • fieldName
    Type: System.String

    The internal name of the SPField object from which to remove a default value.

Return Value

Type: System.Boolean
true if successful;otherwise, false

Exceptions

Exception Condition
ArgumentNullException

The folderPath parameter is set to a null reference (Nothing in Visual Basic) or set to String.Empty. The folderPath parameter should be a server-relative URL that links to a SPFolder object in the document library.

(ArgumentNullException.ParamName="folderPath")

ArgumentNullException

The fieldName parameter is set to a null reference (Nothing in Visual Basic) or set to String.Empty. The fieldName parameter should be an internal name of a SPField object on the document library.

(ArgumentNullException.ParamName="fieldName")

Examples

SPSite site = new SPSite("http://contoso"); SPWeb web = new site.OpenWeb("/"); MetadataDefaults defaults = MetadataDefaults("/Documents", web); defaults.RemoveFieldDefault("/Documents/AdventureWorks", "Title"); defaults.Update();

See Also

Reference

MetadataDefaults Class

MetadataDefaults Members

RemoveFieldDefault Overload

Microsoft.Office.DocumentManagement Namespace

MetadataDefaults