MetadataDefaults.RemoveFieldDefault Method (SPFolder, String)
Removes the default value of a SPField object at a specified SPFolder object.
Namespace: Microsoft.Office.DocumentManagement
Assembly: Microsoft.Office.DocumentManagement (in Microsoft.Office.DocumentManagement.dll)
Syntax
'Declaration
Public Function RemoveFieldDefault ( _
folder As SPFolder, _
fieldName As String _
) As Boolean
'Usage
Dim instance As MetadataDefaults
Dim folder As SPFolder
Dim fieldName As String
Dim returnValue As Boolean
returnValue = instance.RemoveFieldDefault(folder, _
fieldName)
public bool RemoveFieldDefault(
SPFolder folder,
string fieldName
)
Parameters
folder
Type: Microsoft.SharePoint.SPFolderThe SPFolder object for which to remove the metadata default
fieldName
Type: System.StringThe internal name of the SPField object for which to remove a default
Return Value
Type: System.Boolean
true if successful;otherwise, false
Exceptions
Exception | Condition |
---|---|
ArgumentNullException | The folder parameter is set to null. The folder parameter should be a non-null SPFolder object that represents a folder in the document library. (ArgumentNullException.ParamName="folder") |
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 field on the document library. (ArgumentNullException.ParamName="fieldName") |
Examples
SPSite site = new SPSite("http://contoso"); SPWeb web = new site.OpenWeb("/"); MetadataDefaults defaults = MetadataDefaults("/Documents", web); SPFolder folder = web.GetFolder("/Documents/AdventureWorks"); defaults.RemoveFieldDefault(folder, "Title"); defaults.Update();