This topic has not yet been rated - Rate this topic

SPQuery.ProjectedFields Property

SharePoint 2010

Gets or sets the ProjectedFields element XML of the query, which itemizes fields from joined foreign lists so that they can be referenced in the Where element and the ViewFields element.

Namespace:  Microsoft.SharePoint
Assembly:  Microsoft.SharePoint (in Microsoft.SharePoint.dll)
Available in Sandboxed Solutions: Yes
Available in SharePoint Online
public string ProjectedFields { get; set; }

Property Value

Type: System.String
The ProjectedFields element XML.

Each projected field is represented by a Field element. The maximum number of fields that can be included is defined as the difference between the maximum number of allowed fields in the primary list and the number of fields already in the primary list.

The following example shows how to add an additional field to the results returned by the query. The value of the List attribute is an alias to the foreign list. The alias is defined in a Join Element (View). The ShowField attribute must be set to the internal name of the foreign field. The Type is always ‘Lookup’.

<ProjectedFields>
  <Field
    Name=’CustomerCity’
    Type=’Lookup’
    List=’customerCities’
    ShowField=’Title’ />
</ProjectedFields>
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
Do not include "<ProjectedFields>" in value of this property
When setting the value of this property, do not include the <ProjectedFields> parent element, otherwise you'll get an error. If you need to project multiple fields, the value of this property should be set to: "<Field [...]/><Field [...]/><Field [...]/>"