Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
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.StringThe server-relative path of the folder for which to get defaults
fieldName
Type: System.StringThe internal name of the SPField object to get the default for
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");