Share via


SPFieldCollection.TryGetFieldByStaticName Method

Returns the field with the specified static name from the collection.

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

Syntax

'Declaration
Public Function TryGetFieldByStaticName ( _
    staticName As String _
) As SPField
'Usage
Dim instance As SPFieldCollection
Dim staticName As String
Dim returnValue As SPField

returnValue = instance.TryGetFieldByStaticName(staticName)
public SPField TryGetFieldByStaticName(
    string staticName
)

Parameters

  • staticName
    Type: System.String

    A string that specifies the static name of the field.

Return Value

Type: Microsoft.SharePoint.SPField
An SPField object that represents the field. If a field with the specified name does not exist, the return value is a null reference (Nothing in Visual Basic). If more than one field is found, the first one is returned.

See Also

Reference

SPFieldCollection Class

SPFieldCollection Members

Microsoft.SharePoint Namespace

StaticName