Export (0) Print
Expand All
Expand Minimize

SPField.FieldReferences property

Gets a string array that contains the internal names of fields that are referenced in a computed field.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)

'Declaration
PublicReadOnlyPropertyFieldReferencesAsString()
	Get
'Usage
DiminstanceAsSPFieldDimvalueAsString()

value = instance.FieldReferences

Property value

Type: []
Returns String.

The following code example displays the internal names of fields that involve field references.

The example assumes the existence of an .aspx page that contains a label control.

This example requires using directives (Imports in Visual Basic) for the Microsoft.SharePoint and Microsoft.SharePoint.Utilities namespaces.

Dim site As SPSite = SPContext.Current.Site
Dim web As SPWeb = site.AllWebs("Site_Name")
Dim fields As SPFieldCollection = web.Lists("List_Name").Fields
Dim i As Integer

For i = 0 To fields.Count - 1

    Dim refFields As String() = fields(i).FieldReferences

    If Not (refFields Is Nothing) Then

        Dim j As Integer

        For j = 0 To refFields.Length - 1

            Label1.Text += SPEncode.HtmlEncode(refFields(j)) & "<BR>"

        Next j

    End If

Next i
NoteNote

Certain objects implement the IDisposable interface, and you must avoid retaining these objects in memory after they are no longer needed. For information about good coding practices, see Disposing Objects.

Show:
© 2014 Microsoft