MetadataDefaults.GetFieldDefault method (String, String)

Gets the default value for a specified field and folder.

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

Syntax

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

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

Parameters

  • folderPath
    Type: System.String

    The server-relative path of the folder for which to get defaults

Return value

Type: System.String
The default value, or a null reference (Nothing in Visual Basic) if no metadata default is defined for the specified SPFolder object

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 to a folder 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 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); string defaultValue = defaults.GetFieldDefault("/Documents/AdventureWorks", "Title");

See also

Reference

MetadataDefaults class

MetadataDefaults members

GetFieldDefault overload

Microsoft.Office.DocumentManagement namespace

MetadataDefaults